XML data binding in gridview through dropdown selected index

Posted by Ganesh under C# on 11/24/2008 | Views : 8138 | Status : [Member] | Replies : 2
I have bind xml data into dropdown and gridview. When I select any value from dropdown (Asp.Net & C#.Net)), the relevant record only should be in gridview. Please, anybodys help to solve this problem. Earliest reply is more helpful...
My xml file contains
<Catalogs>
<AppName>
<name1>india<name1>
<name2>chennai<name2>
</AppName>
<AppName>
<name1>US<name1>
<name2>atlanda<name2>
</AppName>
</Catalog>

My dropdown id is Ddl. My gridview is GvData




Responses

Posted by: Raja on: 11/24/2008 [Member] Starter

Up
0
Down
I can give you some hint.

Use AutoPostBack property of the DropDowList to true and in the OnSelectedIndexChanged event write the code to populate the GridView based on the SelectedValue of the DropDownList.

Thanks

Regards,
Raja, USA

Ganesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Deysomnath on: 11/25/2008 [Member] Starter

Up
0
Down
Your question is not so clear .... but what i understand is u want to bind the datagrid from a xml file...
so what u have to do is you have to create a dataset and fill it with ur xml file. and then the datagrid with that dataset.

DataSet ds=new DataSet();
ds.ReadXml("MyXmlFile.xml"); // use your Xml file name

Datagrid1.DataSource= ds; //or u can use ds.table[0]
Datagrid1.bind();



Ganesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response