TabStrip Wizard - UserControls

4 posts, 0 answers
  1. Julio Cesar
    Julio Cesar avatar
    2 posts
    Member since:
    Dec 2013

    Posted 14 Jan 2014 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Jan 2014 Link to this post

    Hi,

    Please have a look into the following code snippet to access the value of the RadComboBox SelectedItem.

    C#:
    string value1 = cmbLeavingFrom.SelectedItem.Value;
    //or
    string value2 = cmbLeavingFrom.SelectedValue;

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Julio Cesar
    Julio Cesar avatar
    2 posts
    Member since:
    Dec 2013

    Posted 15 Jan 2014 Link to this post

    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)
    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;
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Jan 2014 Link to this post

    Hi,

    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.
Back to Top