Quantcast
Channel: SharePoint Legacy Versions - Using SharePoint Designer, InfoPath and Other Customizations Forum
Viewing all articles
Browse latest Browse all 2319

How to get Dropdown selected value in codebehind from a DropDownList in infopath

$
0
0

Hi
I have dropdown list.
Values are populated from a xml-file.

private void bindDropdown()        
{           
using (XmlReader reader = XmlReader.Create(@"C:\Users\Administrator\sharepoint\MCW - Documents\XMLFile1.xml"))           
{               
XPathNavigator nav = this.CreateNavigator().SelectSingleNode("/my:myFields/my:InspectionSection", this.NamespaceManager);               
while (reader.Read())               
{                   
if (reader.IsStartElement()
)                   
{                       
switch (reader.Name.ToString()
)                       
{
case "SectionNo":                               
XPathNavigator newNode = null;                               
newNode = nav.Clone();                               
newNode.SelectSingleNode("/my:myFields/my:InspectionSection/my:Displayname", this.NamespaceManager).SetValue(reader.ReadString());                               
newNode.SelectSingleNode("/my:myFields/my:InspectionSection/my:Value", this.NamespaceManager).SetValue(reader.ReadString());                               
nav.InsertAfter(newNode);                               
newNode = null;                               
break;                       
}                   
}               
}               
nav.DeleteSelf();               
nav = null;           
}       
}

I want to get SELECTED-value of the dropdown in code behind.
I am trying to do as follows. But I am always getting blank.

XPathNavigator ddl1 = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ddlSection", this.NamespaceManager);            
String ddlSectionSelectedValue = ddl1.Value;           
MessageBox.Show(ddlSectionSelectedValue);

Please help me to get the selected value in code
thanks in advance



Viewing all articles
Browse latest Browse all 2319

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>