|
Try this
<br />
function Dataset XMLfile()<br />
{<br />
XmlDataDocument xdoc = new XmlDataDocument();<br />
return xdoc.DataSet.ReadXml(Server.MapPath("XMl.xml"));<br />
}<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
dataset ds=XMLfile();<br />
dd1.datasource=ds;<br />
dd1.datatextField="StateCode";<br />
dd1.databind();<br />
}<br />
<br />
<br />
protected void dd2_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
dataset ds=XMLfile();<br />
datarow[] dr=ds.table.select("StateCode='"+dd1.selectedItem.Text+"'");<br />
datatable tb1; <br />
foreach(datarow dr1 in dr)<br />
tb1.ImportRow(dr1);<br />
<br />
dd2.datasource=tb1;<br />
dd2.datatextfield="CountyName"<br />
dd2.databind();<br />
}<br />
<br />
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Hi,
Ive created an SqlDataSource on my page using VS2005 (ASP.Net 2.0 c#), that gets infor from an SQL2005 DB as a DataSet. How do i capture / use this data in the codebehind?
I am ok with capturing this data in the CS file when using a DataReader, but for this problem i need to use a DataSet. How do you grab the data in the DataSet, so its rows etc can be counted and used in the codebehind ?
Please help.
Thanks.
|
|
|
|
|
Come on, this is basic stuff - get a book or do some research on the 'net type "dataset" into google for starters) - before asking people here to donate their time to you for free, you really ought to do some work yourself.
Fred
|
|
|
|
|
Yikes!
Friendly!!!
As it happens Fred i spend a heck of a lot of time helping people out in return in various ways and websites. Surely the whole point of a forum is for people to be able to ask questions and share there knowledge with people who are having difficulties.
|
|
|
|
|
munklefish wrote: i spend a heck of a lot of time helping people out
So do I....
Sorry, but your question is pretty general, and with a little research you can find plenty of tutorials and sample code to help you understand your needs already on the net.
I feel that it is incumbent on users to do some research themselves first, and then only ask questions if they are still stuck on particular points, rather than ask other users here to provode them with all the work.
|
|
|
|
|
Frank!
Perhaps you should read my post then. All i need is help in grabbing the data from the SqlDataSource to the codebehind file so i can work with it. This is far from expecting someone to do it all for me.
For example if my SwlDatasource was providing data as a Reader i would use:
SqlDataReader reader9 = (SqlDataReader)<br />
SqlDataSource9.Select(DataSourceSelectArguments.Empty);<br />
<br />
if(reader9.Read())<br />
{ <br />
<br />
Label1.Text = Convert.ToString(reader9["Log_Pass"]);<br />
<br />
}<br />
reader9.Close();
However i need the data as a DataSet, hence my SqlDataSource is set-up via Vis Studio to provide the data as a DataSet. So all im asking is how i get this from the CS file?
If my question is so annoying for you you should have ignored it. However it would have been much quicker, and easier and less time consuming to have answered me rather than wasting your time complaining!
Plus it would have made me happy, and made your self happy having helped someone! I guess your a typical example of the selfish angst society we are living in today.
Thanks for your time!
|
|
|
|
|
If your dataset is called "ds" then
Loop through the records from counter =0 to ds.Tables(tableName).Rows.Count-1
and then:
Label1.Text = Convert.ToString(ds.Tables(tableName).Rows(counter)(columnName or columnIndex));
Fred
|
|
|
|
|
Hi
Can any one suggest me the good book for c#2.0
Thanks
Hari
|
|
|
|
|
Wrox or Unleased
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
"A Programmer Introduction to C# 2.0 third Edition by Apress" The Authors were Eric Gunnerson and Nick Wienholt.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Depends on what part of the framework you want to learn as well as how much you currently know.
Here[^] are a few (about 2000) search results from MSDN for your perusal.
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
|
i have a link called chat. if i press the link, that chat page should open in a popup and in that popup i have to see only the body of my page (no address bar and also no other bars). and i need to set height and width of that popup.
plz any one help me...
Pradeep Reddy
|
|
|
|
|
Please go through
window.open(url....)
in Javascript
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
thank u...
Pradeep Reddy
|
|
|
|
|
how to find length of div and how to compare privies and present length of div
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
You can specify the length of a div. Otherwise, I'm not sure if there's a property on the client side, but unless you store that property ( probably in a hidden field ), and store it in a control that has runat="server", you're not going to be able to persist it between postbacks. You're not going to find out on the server side, I would not think, as the same div can have different widths, depending on the browser.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Piyush Vardhan Singh wrote: length of div
Did you mean its width and height or length of InnerText ?
|
|
|
|
|
HI experts,
I had a masterpage in one website and woukld like to give reference of the same masterpage to the page in another website which is under the same solution.
Kindly help me in puuting out this...........
|
|
|
|
|
Copy/Paste.
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
honeyss wrote: same masterpage to the page in another website
I don't think you would be able to share like that.
|
|
|
|
|
Hi,
I have outlook 2007 installed in my system.I am saving every message in MHT file(Open a email message,Save As .MHT file), but some times when I save email message, I am giving warning as below.
"You are about to save digital signed email-message in a format which is not secured, Do you want to continue?"
I want to remove this warning and save at the given location automatically (As normal message save).How to set this? Can anybody tell me?
Thanks,
Pavan
|
|
|
|
|
Outlook 2003 is too very strict in security and I don't think it would give way to relax this constraint.
|
|
|
|
|
Hi
I am trying to bind DropDownList with a XML file and I'm successful in doing that.
But in my XML file I have repeated child nodes and I end up with repeated value in my DropDownList.
How to bind DropDownList with distinct values from XML
Please 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
|
|
|
|
|