Make XMLTextWriter And XMLWriterSettings Work Together?
Mar 10, 2010
I have this code for the settings:
Dim settings As XmlWriterSettings = New XmlWriterSettings()
settings.Indent = True
settings.OmitXmlDeclaration = True
settings.NewLineOnAttributes = True
Then I have this code for the writer:
Dim xml As New XmlTextWriter(Server.MapPath("output.xml"), enc)
Please can you tell me how I make the settings apply to the writer?EDIT: Code sample
Sub writexml_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Try
'Vars
[code]...
View 2 Replies
Similar Messages:
Sep 3, 2010
I would like to make a custom accordion, in which I have 2 panes, but where you couldn't open the second one until you clicked a validation button in the first one that would open the second...
I tried to just make a button that would hide the first pane but I cant get to make it work.
[Code]....
[Code]....
View 7 Replies
Mar 11, 2010
I am using the xmltextwriter and having issues with opening tags not showing if the field is blank here is the start of my code
Code:
Dim strFilePath As String = Server.MapPath("../test.xml")
Dim utf8 As Encoding = New UTF8Encoding(False)
Dim objWriter As XmlTextWriter = New XmlTextWriter(strFilePath, New UTF8Encoding(False))
' start writing the XML document
objWriter.WriteStartDocument()
Try
conn.Open()
myreader = cmd.ExecuteReader
objWriter.WriteStartElement("testfile")
While myreader.Read
output the first "product" element
objWriter.WriteStartElement("product", Nothing)
objWriter.WriteElementString("Id", myreader("rvid").ToString)
objWriter.WriteElementString("Class", myreader("RVClass").ToString)
objWriter.WriteElementString("Manu", myreader("rvmanu").ToString)
objWriter.WriteElementString("Model", myreader("rvmake") & " " & myreader("rvmodel"))
objWriter.WriteElementString("Year", myreader("rvyear").ToString)
objWriter.WriteElementString("Price", myreader("rvcashprice").ToString)
objWriter.WriteElementString("NU", myreader("rvnu").ToString)
objWriter.WriteElementString("SCapacity", myreader("rvcapacity").ToString)
objWriter.WriteElementString("Fuel", myreader("rvfuel").ToString)
objWriter.WriteElementString("Length", myreader("rvlenft").ToString)
objWriter.WriteElementString("Air", myreader("rvair").ToString)
objWriter.WriteElementString("Awnings", myreader("rvawnings").ToString)
Thats not all of it.. but what happens is if it is blank value Then i get this, as you see fuel has no opening tags, and the company i am supplying to needs these.
<Price>0.0000</Price>
<NU>U</NU>
<SCapacity>0</SCapacity>
<Fuel />
<Length>0</Length>
What can i do to make this work how i want? I though the .tostring woudl fix it but it didnt.
View 4 Replies
Dec 22, 2010
I have a page where I'm just writing a bunch of XML data to the screen. It's making several database calls to get all the data:
XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
writer.WriteStartDocument();
writer.WriteStartElement("rss");
[code]...
View 4 Replies
Oct 7, 2010
i'm trying to make this work for several days but it just doesn't work.
this is my code:
aspx page:
[Code]....
webservice:
[Code]....
this was downloaded from this website.
the problem is that the page loads fine but no autocomplete occurs.
View 5 Replies
May 3, 2010
How can I make the asyncfileupload to work when a user tabs in to it in the same way as the user clicks on it
View 1 Replies
Jul 17, 2010
In my MVC application I use HandleErrorAttribute to display a custom error page in case of unhandled exceptions, and it works perfectly unless the exception happens in an action called by Ajax.ActionLink. In this case nothing happens. Is it possible to use HandleErrorAttribute to update the target element with the contents of an "Error.ascx" partial view?
View 2 Replies
Dec 25, 2010
This is my Controller method
[HttpPost]
public ActionResult RemoveValue()
{
return View();
}
And this is how i am trying to access to method
@Ajax.ActionLink("Asenkron process", "RemoveValue")
But if i remove HttpPost attribute then it works. I have tested this on MVC 3 RC 2
View 2 Replies
Aug 26, 2010
I am having some issues with deploying my MVC 2 application on a IIS 6 server.I have the following project structure:
/
App/
Controllers/
[code]...
View 2 Replies
Aug 31, 2010
Does anyone know how to make CustomValidator work with controls which are in DetailsView for example ahen updating item
CustomValidator doesnt work on controls which are in detailsView after performin for example update on that detailsView. For example RequiredFiledValidator works with no problem while CustomValidator has problems (Validation doesnt occur):/
View 1 Replies
Jul 6, 2010
i have a problem with the fileupload, does not save anything
View 3 Replies
Oct 30, 2010
i make some button, i want it just work at 12 am only but, the user can change their time on they pc , how to set the time is server time only
View 2 Replies
Feb 2, 2011
I have been trying to make a program work with our IIS server, but it's run into a tricky problem that's been driving me nuts. When I debug the program, everything works perfectly; users are able to log in and they see the appropriate content according to the user's role. When logging in from a remote location, however, the program seems to have trouble finding the users' roles. Users can log in, but they cannot see any role-specific information, so they are stuck on the login page forever.
I tried adding a line of code to find the roles of a particular user. In debug mode, it returned the roles correctly, but when accessed through the server, it returned an empty array that caused my site to crash.
View 1 Replies
Mar 29, 2011
i have a text box, on text_changed event i get one data table which i bind with the grid view, but every time i have to move the cursor out then only it feteches the datatable, while i want to make this search like if i as i change the character in the text box it keep working for all without removing the cursor from the text box, how can i achieve this. Should i use any java script or what.
View 2 Replies
Aug 1, 2010
I have a page with a listview that shows something like posts. On each post there should be a "rate box" which works similar to the "Like" button in facebook. The rate box is a User Control, that has an update panel inside it.
If I put the control with some random values in the page it works great - but when I put it inside the ListView, where it should be located, it won't work. The method is being called, but nothing happens.
I simplified the code a bit to make it easier to understand:
[Code]....
While debugging I noticed the controls in the method "OnRateClick" are empty and don't contain the right values.
View 1 Replies
Aug 27, 2010
I am trying to add validation on my form. I am using AJAX controls in my form fields.
When I remove the Update panel and AJAX control, my validation starts working, but when keeping both the things together, my validation is not working. How could I make them work together?
<script type="text/javascript">
function Validate() {
var QuestionTextArea = document.getElementById("ctl00_ctl00_cphBody_midbox_fvInsert_txtQuestion");
varError = "";
if (!IsTextBoxEmpty(QuestionTextArea, "
Question Text Area not be Empty.")) {
alert(varError);
document.getElementById("ctl00_ctl00_cphBody_midbox_fvInsert_txtQuestion").focus();
return false;
} return true;
}
</script>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtQuestion" runat="server" MaxLength="1000" Columns="50" Rows="5" Style="width: 380px;
float: none" Text='<%# Bind("Description") %>' TextMode="MultiLine" />
<AjaxControl:TextBoxWatermarkExtender runat="server" TargetControlID="txtQuestion"
WatermarkCssClass="water" WatermarkText="Type your Question Here.">
</AjaxControl:TextBoxWatermarkExtender>
</ContentTemplate>
</asp:UpdatePanel>
When I removes ajax extender and Update Panel. My textbox gets validated and when using UpdatePanel. No javascript function created by me is called.
View 1 Replies
Mar 29, 2010
I can't seem to make the RCE work with the following code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> [code]....
View 7 Replies
Feb 25, 2010
I can't make this control work, the code i'm using to test it is:
[Code]....
But what I get when I run it is:
So the buttons are not showing, I could add them manually but then a postback would occour on everyclick.
View 6 Replies
Sep 20, 2010
I have a parent web application and a child web application. I am using single sign on between them. The child application is supposed to redirect anonymous users to the login page of the parent application We just updated both to .net 4.0 framework and now the SSO doesn't work anymore.The setup is as follows. I have the machineKey tag all set up with validation key and decryption key in both applications.then, for authentication tag i have the following in the child app (I have replaced the actual parent app's url with "parentApp" for privacy):
<authentication mode="Forms">
<forms name=".SSOAuth" loginUrl="parentApp/Login.aspx" path="/" protection="All"/>
</authentication>
[code]...
View 1 Replies
Nov 22, 2015
How i can use dropdownlistbox instead listbox for this code?
<div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
rel="stylesheet" type="text/css" />
[Code]....
View 1 Replies
Oct 21, 2010
I am using some code I found that generates a random password. I am in the habit of putting code in a seperate file. The code was written in the same file and I'm trying to move it to a seperate file and get the following message. Also, below, I posted
the original code (code on same page as aspx) and what I did (code in seperate file).what adjustment needs to be made to make the seperate code file work?
Compiler Error Message: BC31143: Method 'Public Function GeneratePassword(length As Integer, numberOfNonAlphanumericCharacters As Integer) As String' does not have a ignature compatible with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.
Source Error:
[Code]....
ORIGINAL CODE (with code on same page)
[Code]....
MY CODE BEHIND
[Code]....
[Code]....
View 2 Replies
May 11, 2010
I have a user control which encapsulates a NumericUpDownExtender. This UserControl implements the interface ICallbackEventHandler, because I want that when a user changes the value of the textbox associated a custom event to be raised in the server. By the other hand each time an async postback is done I shoe a message of loading and disable the whole screen. This works perfect when something is changed in for example an UpdatePanel through this lines of code:
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function (sender, args) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.show();
}
);
The UserControl is placed inside a detailsview which is inside an UpdatePanel in an aspx. When the custom event is raised I want another textbox in the aspx to change its value. So far, When I click on the UpDownExtender, it goes correctly to the server and raises the custom event, and the new value of the textbox is assigned in the server. but it is not changed in the browser.
I suspect that the problem is the callback, since I have the same architecture for a UserControl with an AutoCompleteExtender which implement IPostbackEventHandler and it works. Any clues how can I solve this here to make the UpDownNumericExtender user control to work like the AutComplete one? This is the code of the user control and the parent:
using System;
using System.Web.UI;
using System.ComponentModel;
using System.Text;
namespace Corp.UserControls
{
[Themeable(true)]
public partial class CustomNumericUpDown : CorpNumericUpDown, ICallbackEventHandler
{
protected void Page_PreRender(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
currentInstanceNumber = CorpAjaxControlToolkitUserControl.getNextInstanceNumber();
}
registerControl(this.HFNumericUpDown.ClientID, currentInstanceNumber);
string strCallServer = "NumericUpDownCallServer" + currentInstanceNumber.ToString();
// If this function is not written the callback to get the disponibilidadCliente doesn't work
if (!Page.ClientScript.IsClientScriptBlockRegistered("ReceiveServerDataNumericUpDown"))
{
StringBuilder str = new StringBuilder();
str.Append("function ReceiveServerDataNumericUpDown(arg, context) {}").AppendLine();
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown),
"ReceiveServerDataNumericUpDown", str.ToString(), true);
}
nudeNumericUpDownExtender.BehaviorID = "NumericUpDownEx" + currentInstanceNumber.ToString();
ClientScriptManager cm = Page.ClientScript;
String cbReference = cm.GetCallbackEventReference(this, "arg", "ReceiveServerDataNumericUpDown", "");
String callbackScript = "function " + strCallServer + "(arg, context)" + Environment.NewLine + "{" + Environment.NewLine + cbReference + ";" + Environment.NewLine + "}" + Environment.NewLine;
cm.RegisterClientScriptBlock(typeof(CustomNumericUpDown), strCallServer, callbackScript, true);
base.Page_PreRender(sender,e);
}
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
public Int64 Value
{
get { return (string.IsNullOrEmpty(HFNumericUpDown.Value) ? Int64.Parse("1") : Int64.Parse(HFNumericUpDown.Value)); }
set
{
HFNumericUpDown.Value = value.ToString();
//txtAutoCompleteCliente_AutoCompleteExtender.ContextKey = value.ToString();
// TODO: Change the text of the textbox
}
}
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
[Description("The text of the numeric up down")]
public string Text
{
get { return txtNumericUpDown.Text; }
set { txtNumericUpDown.Text = value; }
}
public delegate void NumericUpDownChangedHandler(object sender, NumericUpDownChangedArgs e);
public event NumericUpDownChangedHandler numericUpDownEvent;
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.Description("Raised after the number has been increased or decreased")]
protected virtual void OnNumericUpDownEvent(object sender, NumericUpDownChangedArgs e)
{
if (numericUpDownEvent != null) //check to see if anyone has attached to the event
numericUpDownEvent(this, e);
}
#region ICallbackEventHandler Members
public string GetCallbackResult()
{
return "";//throw new NotImplementedException();
}
public void RaiseCallbackEvent(string eventArgument)
{
NumericUpDownChangedArgs nudca = new NumericUpDownChangedArgs(long.Parse(eventArgument));
OnNumericUpDownEvent(this, nudca);
}
#endregion
}
/// <summary>
/// Class that adds the prestamoList to the event
/// </summary>
public class NumericUpDownChangedArgs : System.EventArgs
{
/// <summary>
/// The current selected value.
/// </summary>
public long Value { get; private set; }
public NumericUpDownChangedArgs(long value)
{
Value = value;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Corp
{
/// <summary>
/// Summary description for CorpAjaxControlToolkitUserControl
/// </summary>
public class CorpNumericUpDown : CorpAjaxControlToolkitUserControl
{
private Int16 _currentInstanceNumber; // This variable hold the instanceNumber assignated at first place.
public short currentInstanceNumber
get { return _currentInstanceNumber; }
set { _currentInstanceNumber = value; }
}
protected void Page_PreRender(object sender, EventArgs e)
{
const string strOnChange = "OnChange";
const string strCallServer = "NumericUpDownCallServer";
StringBuilder str = new StringBuilder();
foreach (KeyValuePair<String, Int16> control in controlsToRegister)
{
str.Append("function ").Append(strOnChange + control.Value).Append("(sender, eventArgs) ").AppendLine();
Append("{").AppendLine();
str.Append(" if (sender) {").AppendLine();
str.Append(" var hfield = document.getElementById('").Append(control.Key).Append("');").AppendLine();
str.Append(" if (hfield.value != eventArgs) {").AppendLine();
str.Append(" hfield.value = eventArgs;").AppendLine();
str.Append(" ").Append(strCallServer + control.Value).Append("(eventArgs, eventArgs);").AppendLine();
str.Append(" }").AppendLine();
str.Append(" }").AppendLine();
str.Append("}").AppendLine();
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown), Guid.NewGuid().ToString(), str.ToString(), true);
}
str = new StringBuilder();
foreach (KeyValuePair<String, Int16> control in controlsToRegister)
{
str.Append(" funcsPageLoad[funcsPageLoad.length] = function() { $find('NumericUpDownEx" + control.Value + "').add_currentChanged(").Append(strOnChange + control.Value).Append(");};").AppendLine();
str.Append(" funcsPageUnLoad[funcsPageUnLoad.length] = function() { $find('NumericUpDownEx" + control.Value + "').remove_currentChanged(").Append(strOnChange + control.Value).Append(");};").AppendLine();
}
Page.ClientScript.RegisterClientScriptBlock(typeof(CorpNumericUpDown), Guid.NewGuid().ToString(), str.ToString(), true);
}
}
}
and to create the loading view I use this: //The beginRequest event is raised before the processing of an asynchronous postback starts and the postback is sent to the server. You can use this event to call custom script to set a request header or to start an animation that notifies the user that the postback is being processed.
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
function (sender, args) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.show();
}
);
//The endRequest event is raised after an asynchronous postback is finished and control has been returned to the browser. You can use this event to provide a notification to users or to log errors.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(
function (sender, arg) {
var modalPopupBehavior = $find('programmaticSavingLoadingModalPopupBehavior');
modalPopupBehavior.hide();
}
);
View 1 Replies
Jun 1, 2010
I have 5 checkboxes in my form is there a way to make them work like radio buttons using jquery.
View 2 Replies
Dec 24, 2010
I just finished programming a web application, and I want to upload it to a host server so that it works online. However, I faced some problems.When recalling functions from class files, server can't approach them, and the following error appears: (BC30002: Type 'db_class' is not defined)I know that there are steps I have to do in this stage in order to make the project working. I want your help letting me know what these steps are!
I have reviewed many references and posts in this forum, but I couldn't reach a solution.I built a small project that contains ( default.aspx, app_code/class1.vp and web.config). It would survive my graduation project if you would downloading the project and fix the error appearing, and return me back the modified code. I tried many things on my hand to get fixed, but with no result.[URL]
View 1 Replies
Feb 26, 2011
I am trying to put a basic Hello World Web Service in my Go Daddy Shared hosting.
It is a basic default Hello World Web Service that Visual Studio 2010 automatically generates: it works in my local web machine: i can invoke and can see the xml.
I have transferred the Service1.asmx and the Service1.cs file( in the App_Code folder ). I can view the web service page, but I cannot invoke the web service method, and as a result I cannot see the xml file where the "Hello World" string will be in side the <string> element.
Though I can see the web service page, there is no invoke button. How will I invoke or render the content in an aspx page? As the web page has to change the name space, I have changed the namespace to my website address, but still I cannot see or do an invocation and as a result cannot see the generated xml. My question is
1) what should I do so that I can see the return xml value from the web service?
2) what should I do so that I can render the data of the web service in a web page ( for example, in mywebservicepage.aspx)?
[Code]....
View 2 Replies