473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Filtering the XML Nodes bound with dropdownlist

Hello Friends, I have two DropDownList: 1) CollegeDDL which contains Four static names of the colleges. : Homeopathic Medical College,Physiotherapy College,Institute of Ayurveda,Institute of Business Administration


2) CourseDDL which is bind to CourseDetail.XML.
Expand|Select|Wrap|Line Numbers
  1.  
  2.         <Institutes>  
  3.         <Institute>
  4.         <InstituteName>  Homoeopathic Medical College  </InstituteName>
  5.         <Course> <CourseName>  BHMS                    </CourseName> </Course>    
  6.         <Course> <CourseName>  MD(Repertary)           </CourseName> </Course>    
  7.         <Course> <CourseName>  MD(Organon of Medicine) </CourseName> </Course>    
  8.         <Course> <CourseName>  MD(Materia Medica)      </CourseName> </Course>    
  9.         </Institute>
  10.  
  11.         <Institute>
  12.         <InstituteName>  Physiotherapy College  </InstituteName>
  13.         <Course> <CourseName>  BPT          </CourseName> </Course>    
  14.         <Course> <CourseName>  BPT(Sports)  </CourseName> </Course>    
  15.         <Course> <CourseName>  BPT(Cardio)  </CourseName> </Course>
  16.         </Institute>
  17.  
  18.         <Institute>
  19.         <InstituteName>  Institute of Ayurved  </InstituteName>
  20.         <Course> <CourseName>  BAMS          </CourseName> </Course>
  21.         <Course> <CourseName>  BAMS(Nature)  </CourseName> </Course>
  22.         <Course> <CourseName>  BAMS(Plants)  </CourseName> </Course>
  23.         </Institute>
  24.  
  25.         <Institute>
  26.         <InstituteName> Institute of Business Administration </InstituteName>
  27.         <Course> <CourseName>BBA</CourseName> </Course>    
  28.         <Course> <CourseName>DBM</CourseName> </Course>    
  29.         <Course> <CourseName>BBA(Distance)</CourseName> </Course>    
  30.         </Institute>
  31.  
---------------------------------
CourseDetail.XSL
Expand|Select|Wrap|Line Numbers
  1.  
  2.         <xsl:template match ="/">
  3.  
  4.         <Institute>
  5.         <xsl:apply-templates select ="Institutes/Institute/Course"/>
  6.         </Institute>
  7.  
  8.         </xsl:template>
  9.  
  10.  
  11.         <xsl:template match ="Institutes/Institute/Course">
  12.         <Institute>
  13.         <xsl:attribute name="CourseName">
  14.         <xsl:value-of select="CourseName"/>
  15.         </xsl:attribute>
  16.         </Institute>
  17.  
  18.         </xsl:template>
  19.  
  20.         </xsl:stylesheet> 
------------------------
I have bind Coursedetail.XML to CourseDDL and CourseDetail.XSL (No XPATH Expression)

After doing this, My CourseDDL is correctly filled with all the CourseName value of my XML file.
But now I want to filter the data bound to CourseDDL , based on College Name selected in CollegeDDL.

For Example:Currently my CourseDDL contains all the CourseName : BHMS,MD(Repertary),MD(Organon of Medicine),......,DBM,BBA(Distance).

But when I select "Homoeopathic Medical College" in CollegeDDL , The data bound to CourseDDL should filter accordingly.
It means when I select "Homoeopathic Medical College" , my CourseDDL should Display only that course: BHMS,MD(Repertary),MD(Organon of Medicine),MD(Materia Medica)

------------------------------------
I have tried the following , but could not achieve it.
Expand|Select|Wrap|Line Numbers
  1.         1) XmlDataSourceCourse.XPath = "/Institutes/Institute[InstituteName='" +         CollegeDDL.SelectedItem.Value + "']"
  2.  
  3.         2) XmlDataSourceCourse.XPath = "/Institutes/Institute[InstituteName='" +         ddlinstitute.SelectedItem.Value + "']/Course"
  4.  
  5.         3)XmlDataSourceCourse.XPath = "/Institutes/Institute[InstituteName='" + ddlinstitute.SelectedItem.Value + "']/Course/CourseName"
  6.  
Anybody please help to format correct XPATH Expression to achive this.
May 7 '12 #1
0 1540

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format...
1
by: enrico sabbadin | last post by:
hi, while playing with the SAML specs I found that one must insert a node like this if the call succeded <status xmlns:z=mynamspace" ... <z:statuscode result="z:Sucess"/> ... How do I...
0
by: sklett | last post by:
I'll try asking this a different way. If I have a bound DropDownList and a Button on a page. When I hit the button it causes a postback. The DropDownList does not get re-bound on the postback,...
4
by: Keith | last post by:
I have this simple scenario. -------- Choose an item ->dropdownlist-> or <a>Create a new item</a> -------- When someone decides to click on the create a new item link, it takes them to a...
1
by: Mohamed Zaki | last post by:
Dear All, I've a datagrid in its footer i added a drop down list and some text boxes and a link button to add new records in the database, however i populate the dropdown list in the ItemDataBind,...
2
by: Paul Owen | last post by:
Hmm, nobody seems to want to answer any of my questions, but here goes again! I have a Detailview control that is bound to a data source. Within the Detailview control I have a number of...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
15
by: sam | last post by:
Hi, I have a bound dropdownlist with an event handler OnSelectedIndexChanged. If I select a value I'm redirected to another page. I come back using the browser's back button, and the option is...
1
by: Chris Fulstow | last post by:
Hi all, I've got a simple data-bound DropDownList control: <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1" DataTextField="EmployeeName"...
0
by: Vagabond Software | last post by:
I am fairly new to ASP.NET, so bear with me... I have a Datagrid with a data-bound DropDownList in the TemplateColumn. Here is the HTML code: <asp:TemplateColumn HeaderText="Void"> <ItemStyle...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.