Julio Cesar
Top achievements
Rank 1
Julio Cesar
asked on 15 Jan 2014, 12:00 AM
hi, i have to get de DataFieldValue of a RadComboBox or RadList, but i can´t, i am using the Rad TabStrip Wizard Demo with ascx´s but i only can to get the Text property of a RadComboBox Selected Item like Demo, can you help me!
thanks
thanks
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 15 Jan 2014, 04:00 AM
Hi,
Please have a look into the following code snippet to access the value of the RadComboBox SelectedItem.
C#:
Please elaborate your requirement if it doesn't help.
Thanks,
Princy.
Please have a look into the following code snippet to access the value of the RadComboBox SelectedItem.
C#:
string value1 = cmbLeavingFrom.SelectedItem.Value;//orstring value2 = cmbLeavingFrom.SelectedValue;Please elaborate your requirement if it doesn't help.
Thanks,
Princy.
0
Julio Cesar
Top achievements
Rank 1
answered on 15 Jan 2014, 02:40 PM
Thanks, i´ll try to explain better..
I have two UserControls, control1.ascx and control2.ascx, in Control1 i have a radcombobox, in the control2 i have a radlistbox which filled with the selected value of radcombobox found in control1, my problem is that when i call the value of Item Selected I can not access it, only I can see the text property, my code is as follows:
in this case, the object (ddlRamo) values are:
DataTextField = "VIDA"
DataValueField = 5
but the value of the variable (var) is empty,
the value of the variable (varFound) is "VIDA"
so how can i get the value of the selected item in RadComboBox (in this case is 5)
I have two UserControls, control1.ascx and control2.ascx, in Control1 i have a radcombobox, in the control2 i have a radlistbox which filled with the selected value of radcombobox found in control1, my problem is that when i call the value of Item Selected I can not access it, only I can see the text property, my code is as follows:
in this case, the object (ddlRamo) values are:
DataTextField = "VIDA"
DataValueField = 5
but the value of the variable (var) is empty,
the value of the variable (varFound) is "VIDA"
so how can i get the value of the selected item in RadComboBox (in this case is 5)
RadMultiPage multiPage = (RadMultiPage)this.NamingContainer.FindControl("RadMultiPage1"); RadPageView NominaPageView = multiPage.FindPageViewByID("Nomina"); Control NominaUserControl = NominaPageView.FindControl("NominauserControl"); RadComboBox uddlRamo = (RadComboBox)NominaUserControl.FindControl("ddlRamo"); string var = uddlRamo.SelectedValue;
string varFound = uddlRamo.Text;
0
Princy
Top achievements
Rank 2
answered on 16 Jan 2014, 03:16 AM
Hi,
Please have a look into the sample code snippet to achieve your scenario.
ASPX:
UserControl Page 1:
UserControl Page 2:
UserControl Page 1 C#:
Let me know if you have any concern.
Thanks,
Princy.
Please have a look into the sample code snippet to achieve your scenario.
ASPX:
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"> <Tabs> <telerik:RadTab Text="ComboBox" PageViewID="RadPageView1"> </telerik:RadTab> <telerik:RadTab Text="ListBox" PageViewID="RadPageView2"> </telerik:RadTab> </Tabs></telerik:RadTabStrip><telerik:RadMultiPage ID="RadMultipage1" runat="server"> <telerik:RadPageView ID="RadPageView1" runat="server"> <uc1:combo ID="combo1" runat="server" /> </telerik:RadPageView> <telerik:RadPageView ID="RadPageView2" runat="server"> <uc2:ListBox ID="ListBox1" runat="server" /> </telerik:RadPageView></telerik:RadMultiPage>UserControl Page 1:
<telerik:RadComboBox runat="server" ID="RadComboBox1" EmptyMessage="Select" MaxHeight="250px" Width="200px" DataTextField="Cityname" DataValueField="Countryname" DataSourceID="SqlDataSource1"></telerik:RadComboBox><telerik:RadButton ID="RadButton1" runat="server" Text="Submit" OnClick="RadButton1_Click"></telerik:RadButton>UserControl Page 2:
<telerik:RadListBox ID="RadListBox1" runat="server"></telerik:RadListBox>UserControl Page 1 C#:
protected void RadButton1_Click(object sender, EventArgs e){ GoToNextTab(); GoToNextPageView(); UpdateNextPageView();}private void GoToNextTab(){ RadTabStrip tabStrip = (RadTabStrip)this.NamingContainer.FindControl("RadTabStrip1"); RadTab ListTab = tabStrip.FindTabByText("ListBox"); ListTab.Enabled = true; ListTab.Selected = true;}private void GoToNextPageView(){ RadMultiPage multiPage = (RadMultiPage)this.NamingContainer.FindControl("RadMultiPage1"); RadPageView listpageview = multiPage.FindPageViewByID("RadPageView2"); listpageview.Selected = true;}private void UpdateNextPageView(){ RadMultiPage multiPage = (RadMultiPage)this.NamingContainer.FindControl("RadMultiPage1"); RadPageView NominaPageView = multiPage.FindPageViewByID("RadPageView2"); Control NominaUserControl = NominaPageView.FindControl("ListBox1"); RadListBox List = (RadListBox)NominaUserControl.FindControl("RadListBox1"); string var = RadComboBox1.SelectedValue; string varFound = RadComboBox1.Text; if (var == "Australia") // your condition { //bind radlistbox } else { //bind radlistbox }}Let me know if you have any concern.
Thanks,
Princy.