|
I am getting following error in production environment
i.e The state information is invalid for this page and might be corrupted error while executnin aspx page.It is working fine in Development environment.
Please any one can give clue about this
|
|
|
|
|
Hi
In my application, I have a ListBox which is to be filled with the values in XML file.
My application goes like this.....
I am getting a State name of USA from the QueryString, with the help of a that QueryString I have to get the Names of Counties of that State, which r in a XML file on to a ListBox.
My XML File looks like this
<USA>
<CountyUSA>
<StateCode>AK</StateCode>
<StateName>Alaska </StateName>
<CountyName>Aleutians East</CountyName>
</CountyUSA>
<CountyUSA>
<StateCode>AK</StateCode>
<StateName>Alaska </StateName>
<CountyName>Aleutians West</CountyName>
</CountyUSA>
.....
.....
<CountyUSA>
<StateCode>AL</StateCode>
<StateName>Alabama </StateName>
<CountyName>Autauga</CountyName>
</CountyUSA>
<CountyUSA>
<StateCode>AL</StateCode>
<StateName>Alabama </StateName>
<CountyName>Baldwin</CountyName>
</CountyUSA>
.....
.....
<CountyUSA>
<StateCode>GA</StateCode>
<StateName>Georgia </StateName>
<CountyName>Campbell</CountyName>
</CountyUSA>
<CountyUSA>
<StateCode>GA</StateCode>
<StateName>Georgia </StateName>
<CountyName>Milton</CountyName>
</CountyUSA>
</USA>
How can I get only County Names of a particular State for this XML file.
Suggest me an Example.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
XmlDataDocument xdoc = new XmlDataDocument();<br />
XmlTextReader Reader = new XmlTextReader(server.MapPath("XML.xml"));<br />
xdoc.DataSet.ReadXml(Reader, XmlReadMode.InferSchema);<br />
ddl.datasource=xdoc.dataset;<br />
ddl.DataTextField="CountryName";<br />
ddl.databind();
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Thank u Imran Khan Pathan for u reply.
It is giving only the Counties of only one State i.e first in the list.
I want to get Counties of different States with the help of a QueryString.
Where I have to give this QueryString to get the Data for Different State's Counties
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
U can select using DataTabale.Select Method
DataTable dt=ds.table[0];
datarow[] dr=dt.select("State='"+var+"'");
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Ok
How can I use this in your given code.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
DataSet ds=xdoc.dataset;<br />
DataTable dt=ds.table[0];<br />
DataRow[] dr=dt.select("State='"+statename+"'");<br />
DataTable dt1=new DataTable();<br />
foreach(DataRow dr1 in dr)<br />
{<br />
dt1.Rows.Add(dr1)<br />
}<br />
ddl.DataSource=dt1;<br />
ddl.DataTextField="CountryName";<br />
ddl.databind();
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
use this code to bound ur dropdownlist anjoy the coding
Dim _Doc As New System.Xml.XmlDocument
_Doc.Load("file:///C:/testxml.xml")
Dim NodeList As System.Xml.XmlNodeList = _Doc.SelectNodes("/USA/CountyUSA/CountyName")
For Each node As System.Xml.XmlNode In NodeList
Dim ss As String = node.InnerText
DropDownList1.DataSource = ss
DropDownList1.DataBind()
Next
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
|
|
|
|
|
where i stored CountyName in ss string. u store all CountyName in hash table or collection then bind drop down list(out side the for each)
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
|
|
|
|
|
Thank u for u r reply Piyush Vardhan Singh
But I am having all the County Names of different States in a single XML file.
How can I get County Names of each State in order to bind that Data to ListBox.
As I said earlier I getting that State Name in a QueryString, with that Name in the QueryString I have to get the Couty Names of that State.
How can I make this kind of selection.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison
Thank u
Chandu
|
|
|
|
|
Hello,
VS 2005
I tried to follow this article about how to specify a virtual directory to install a web service project.
http://www.codeproject.com/useritems/ChangeVDirWebSetupProject.asp
In my project i am using a installer class and 1 custom action. But I don't think this would cause any problem, as it worked everytime before I added the virtual directory.
However, i get this error message during the installation.
Exception occurred while initializing the installation.
System.IO.FileNotFoundException: Could not load file or assembly.
'File:///C:\windows\System32\Software\myWebService\Website\PDA\' or one of its dependencies. The system cannot find the file specified.
If anyone has had this kind of error before, or know of a better method to specify a virtual directory to install to. Please let me know.
Many thanks,
Steve
|
|
|
|
|
Hi to all,
When i change the state of asp.net checkboxlist using javascript, code behind is not getting the currently change state of control,
actually i have checkboxlist control of asp.net with 3 members, agaisnt them i have 3 dropdownlist controls of asp.net, when i check first check box dropdownlist no.1 enable and vice versa, but when i enable the dropdownlist using javascript, code behind dont consider it as enable, in code behind i do disable dropdownlist and using javascript i want to enable or disable them.
Java script function which i am using,
------
function Toggle()
{
var TB = document.getElementById('chk_list').childNodes[0];
var d1 = document.getElementById("ddl_mbbs");
var d2 = document.getElementById("ddl_fcps");
var d3 = document.getElementById("ddl_dlo");
var d4 = document.getElementById("ddl_other");
var t = document.getElementById("txtOthers");
for (var i=0;i<tb.childnodes.length; i++)
="" {
="" var="" currenttd="TB.childNodes[i].childNodes[0];
" listcontrol="currentTd.childNodes[0];
"
="" if="" (="" i="=" 0="" )
="" listcontrol.checked="=" true="" d1.disabled="false;
" else
="" }
="" 1="" d2.disabled="false;
" }="" 2="" d3.disabled="false;
" 3="" d4.disabled="false;
" t.disabled="false;
" }
<="" script="">
----------
And code behind is
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
chk_list.Items(0).Attributes.Add("onclick", "ToggleTextbox();")
chk_list.Items(1).Attributes.Add("onclick", "ToggleTextbox();")
chk_list.Items(2).Attributes.Add("onclick", "ToggleTextbox();")
chk_list.Items(3).Attributes.Add("onclick", "ToggleTextbox();")
If Not IsPostBack Then
add_years()
chk_box()
End If
End Sub
Sub add_years()
Dim i As Integer = 1930
For i = 1930 To Now.Year
ddl_mbbs.Items.Add(i)
ddl_fcps.Items.Add(i)
ddl_dlo.Items.Add(i)
ddl_other.Items.Add(i)
Next
End Sub
Sub chk_box()
ddl_mbbs.Enabled = False
txtOthers.Enabled = False
ddl_fcps.Enabled = False
ddl_dlo.Enabled = False
ddl_other.Enabled = False
End Sub
Protected Sub btn_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_submit.Click
If ddl_mbbs.SelectedValue = "None" Then
lblerr.Text = "Enter Qualification."
Else
Session.Add("fname", Txt_fname.Text)
If ddl_mbbs.Enabled = True Then
Session.Add("mbbs", ddl_mbbs.SelectedValue)
Else
Session.Add("mbbs", -1)
End If
If txtOthers.Enabled = True Then
Session.Add("mcps", ddl_other.SelectedValue)
Session.Add("str_others", txtOthers.Text)
Else
Session.Add("mcps", -1) '---------------Change mcps = -1
End If
If ddl_fcps.Enabled = True Then
Session.Add("fcps", ddl_fcps.SelectedValue)
Else
Session.Add("fcps", -1)
End If
If ddl_dlo.Enabled = True Then
Session.Add("dlo", ddl_dlo.SelectedValue)
Else
Session.Add("dlo", -1)
End If
Response.Redirect("regDoc_1.aspx")
End If
End Sub
-----------------------
If someone could help
|
|
|
|
|
Hi All,
How can i display xml node and sub node(only element)in multi level hierarchial grid. if any one have some sample code please send me.
My sample xml file is:
<ctfile>
<documentname>CES Student File
<ctfversion>1.1
<documentcreationdatetime>2006-01-17T14:29:48
<documentqualifier>full
<supplierid>SIMS
<sourceschool>
<lea>
<estab>
<schoolname>
<ctfpupildata>
<upn>
<surname>
<forename>
<dob>
<gender>
<basicdetails>
<preferredsurname>BATES
<preferredforename>RYAN
<ncyearactual>10
<ethnicity>WBRI
Thanks & Regards,
Pravat Sharma
Pravat Sharma
|
|
|
|
|
i want to calculate the address of the client which is accessing my website. fro that i am using the following code.
Request.UserHostAddress.ToString()
is this right
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
I don't think so, it will give you the address of the server. Try this instead:
Request.ServerVariables["REMOTE_ADDR"].ToString();
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi there,
I've got a problem about usercontrol in asp.net 2.0.
In my usercontrol, I've got a button and a public property. When the button is clicked, the property will be set to 1.
public partial class WebUserControl : System.Web.UI.UserControl<br />
{<br />
private int _number;<br />
<br />
public int Number {<br />
get {<br />
return this._number;<br />
}<br />
set {<br />
this._number = value;<br />
}<br />
}<br />
<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
this._number = 10;<br />
}<br />
}
Then, I put this usercontrol into a page. Set its Number property to 1.
The problem is after I click the usercontrol's button, its Number property didn't change to 10
Any wrong here???
Pls help me. Thanks alot.
|
|
|
|
|
kokain wrote: this._number = 10;
You are assigning to variable, not to property
|
|
|
|
|
Hi NAvaneeth,
Whenever user get the value of the property, the _number variable is return. Anyway, the same problem when assigning to property like your opinion.
Thank you.
|
|
|
|
|
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" EnableViewState="false"%> here i have disabled the view state. i have textbox too.<asp:textbox id="TextBox1" runat="server" enableviewstate="false"> here is viewstate disabled.now the situation is when i type some text in textbox and then click the button it redirects me to another page then i click the back button i still get the text in the textbox.y this is happening so?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
When pressing the back button in the browser the page is not reloaded but comes from a version which is essenitally cached in the browser which is why the data is still there.
|
|
|
|
|
so how can i disable the viewstate , i mean how to implement the viewstate in my program.i have 60 textboxes in the fom, i manually can't clear the textboxes at runtime.is there any property that hides the data or i need to set the textbox.text=""
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
You cant do anything when the back button is pressed since no server-side code will be executed. You can expire the page though which will ensure that the page is re-loaded from code when the back button is pressed
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
|
|
|
|
|
thanks SHatchard, can't i do these things with the help of Enableviewstate.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Sonia Gupta wrote: can't i do these things with the help of Enableviewstate.
ViewStates are not used for just clearing the values. It is a mechanism used by ASP.NET to persist data on postback. If you disable viewstate for a control/page level, you won't be able to get the data entered in the textbox when page posts back.
|
|
|
|
|
U can clear all textboxes using find control.
Put all textbox in table and find out control and if control is textbox then clear it. So simple
Best Regard
Pathan
---------------------------------------------------
|
|
|
|