RadTabStrip and DataValueField

7 posts, 0 answers
  1. Willem
    Willem avatar
    5 posts
    Member since:
    Oct 2012

    Posted 04 Oct 2012 Link to this post

    Hello,



    How can I get the value of the DataValueField from a RadTabStrip into a textbox or a label?

    I need this value for a parameter into a SqlDataSource.



    Greetings,

    Willem Visser
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Oct 2012 Link to this post

    Hi,

    Try the following code to achieve your scenario.
    C#:
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
         RadTabStrip tab = (RadTabStrip)sender;
         TextBox1.Text = tab.DataTextField.ToString();
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Willem
    Willem avatar
    5 posts
    Member since:
    Oct 2012

    Posted 04 Oct 2012 Link to this post

    Thank you for your help.



    I have try this, and get a Javascript: SyntacError, inputstring wrong



    protected void RadTabStrip2_TabClick(object sender, RadTabStripEventArgs e)

    {

    RadTabStrip tab = (RadTabStrip)sender;

    AdresID.Text = tab.DataValueField.ToString();

    }



    Greetings,

    Willem Visser

  5. Willem
    Willem avatar
    5 posts
    Member since:
    Oct 2012

    Posted 04 Oct 2012 Link to this post

    Here is the source code of the page, I use a master page.



    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/iControl.master" AutoEventWireup="true" CodeFile="Accounts.aspx.cs" Inherits="Accounts_Accounts" %>

    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

    <style type="text/css">

    .MyImageButton {

    cursor: auto;

    }

    .EditFormHeader td {

    font-size: 14px;

    padding: 4px !important;

    color: #0066cc;

    }

    </style>

    </asp:Content>

    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">

    <AjaxSettings>

    <telerik:AjaxSetting AjaxControlID="RadGrid1">

    <UpdatedControls>

    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />

    <telerik:AjaxUpdatedControl ControlID="Waarde" />

    <telerik:AjaxUpdatedControl ControlID="RadTabStrip2" />

    <telerik:AjaxUpdatedControl ControlID="FormView1" />

    <telerik:AjaxUpdatedControl ControlID="SqlDataSource4" />

    <telerik:AjaxUpdatedControl ControlID="SqlDataSource3" />

    </UpdatedControls>

    </telerik:AjaxSetting>

    </AjaxSettings>

    </telerik:RadAjaxManager>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"

    ConnectionString="<%$ ConnectionStrings:iControlConnectionString %>"

    SelectCommand="SELECT [accountid], [naam_account], [website], [btwnr], [kvknr], [branche], [leverancier], [klant], [notitie] FROM [account] ORDER BY [naam_account]">

    </asp:SqlDataSource>

    <telerik:RadSplitter ID="RadSplitter1" runat="server"

    Width="100%"

    Height="950px"

    Orientation="Horizontal">

    <telerik:RadPane ID="RadPane1" runat="server"

    Width="100%"

    Height="100%">

    <telerik:RadSplitter ID="RadSplitter2" runat="server"

    Orientation="Horizontal"

    Width="100%"

    Height="100%">

    <telerik:RadPane ID="RadPane2" runat="server"

    Width="100%"

    Height="60%">

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0" DataSourceID="SqlDataSource2" GridLines="None" Skin="Office2010Silver" AutoGenerateColumns="False" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">

    <ClientSettings EnablePostBackOnRowClick="true" >

    <Selecting AllowRowSelect="True" />

    </ClientSettings>

    <MasterTableView DataSourceID="SqlDataSource2" DataKeyNames="accountid" >

    <CommandItemSettings ExportToPdfText="Export to PDF" />

    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">

    <HeaderStyle Width="20px" />

    </RowIndicatorColumn>

    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">

    <HeaderStyle Width="20px" />

    </ExpandCollapseColumn>

    <Columns>

    <telerik:GridBoundColumn DataField="accountid" DataType="System.Int32" FilterControlAltText="Filter accountid column" HeaderText="accountid" ReadOnly="True" SortExpression="accountid" UniqueName="accountid" Visible="False">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="naam_account" FilterControlAltText="Filter naam_account column" HeaderText="naam_account" SortExpression="naam_account" UniqueName="naam_account">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="website" FilterControlAltText="Filter website column" HeaderText="website" SortExpression="website" UniqueName="website">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="btwnr" FilterControlAltText="Filter btwnr column" HeaderText="btwnr" SortExpression="btwnr" UniqueName="btwnr">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="kvknr" FilterControlAltText="Filter kvknr column" HeaderText="kvknr" SortExpression="kvknr" UniqueName="kvknr">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="branche" DataType="System.Int32" FilterControlAltText="Filter branche column" HeaderText="branche" SortExpression="branche" UniqueName="branche">

    </telerik:GridBoundColumn>

    <telerik:GridCheckBoxColumn DataField="leverancier" DataType="System.Boolean" FilterControlAltText="Filter leverancier column" HeaderText="leverancier" SortExpression="leverancier" UniqueName="leverancier">

    </telerik:GridCheckBoxColumn>

    <telerik:GridCheckBoxColumn DataField="klant" DataType="System.Boolean" FilterControlAltText="Filter klant column" HeaderText="klant" SortExpression="klant" UniqueName="klant">

    </telerik:GridCheckBoxColumn>

    <telerik:GridBoundColumn DataField="notitie" FilterControlAltText="Filter notitie column" HeaderText="notitie" SortExpression="notitie" UniqueName="notitie">

    </telerik:GridBoundColumn>

    </Columns>

    <EditFormSettings>

    <EditColumn FilterControlAltText="Filter EditCommandColumn column">

    </EditColumn>

    </EditFormSettings>

    </MasterTableView>

    <FilterMenu EnableImageSprites="False">

    </FilterMenu>

    </telerik:RadGrid>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"

    ConnectionString="<%$ ConnectionStrings:iControlConnectionString %>"

    SelectCommand="SELECT [accountid], [naam_account], [website], [btwnr], [kvknr], [branche], [leverancier], [klant], [notitie] FROM [account] ORDER BY [naam_account]">

    </asp:SqlDataSource>

    <asp:Label ID="Waarde" runat="server" Visible="False" ></asp:Label>

    </telerik:RadPane>

    <telerik:RadPane ID="RadPane3" runat="server"

    Width="100%"

    Height="40%">

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server"

    Skin="Office2010Silver"

    MultiPageID="RadMultiPage1"

    AutoPostBack="True">

    <Tabs>

    <telerik:RadTab runat="server" Text="Adressen" PageViewID="RadPageAdressen" Selected="True"></telerik:RadTab>

    <telerik:RadTab runat="server" Text="Contact Personen" PageViewID="RadPageContactPersoon"></telerik:RadTab>

    <telerik:RadTab runat="server" Text="Projecten" PageViewID="RadPageProjecten"></telerik:RadTab>

    <telerik:RadTab runat="server" Text="Uren" PageViewID="RadPageUren"></telerik:RadTab>

    <telerik:RadTab runat="server" Text="Offertes" PageViewID="RadPageOffertes"></telerik:RadTab>

    <telerik:RadTab runat="server" Text="Fakturen" PageViewID="RadPageFakturen"></telerik:RadTab>

    </Tabs>

    </telerik:RadTabStrip>

    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">

    <telerik:RadPageView ID="RadPageAdressen" runat="server">

    <telerik:RadTabStrip ID="RadTabStrip2" runat="server"

    DataSourceID="SqlDataSource3"

    Skin="Office2010Silver"

    DataTextField="straat"

    DataValueField="account_adressenid"

    AutoPostBack="true"

    MultiPageID="RadMultiPage2"

    DataFieldID="accountid"

    OnTabClick="RadTabStrip2_TabClick" >

    </telerik:RadTabStrip>

    <telerik:RadMultiPage ID="RadMultiPage2" runat="server" >

    <telerik:RadPageView ID="RadPageView1" runat="server">

    <asp:Label ID="AdresID" runat="server" ></asp:Label>

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="account_adressenid" DataSourceID="SqlDataSource4">

    <ItemTemplate>

    <br />

    <div id="formDiv" style="float: left;">

    <table id="formTable">

    <tr>

    <td>Account:</td>

    <td>

    <asp:CheckBox ID="CheckBoxAccount" runat="server" Text='<%# Eval("adres_account") %>' />

    </td>

    <td>Contactpersoon:</td>

    <td>

    <asp:CheckBox ID="CheckBoxContactPersoon" runat="server" Text='<%# Eval("adres_contactpersoon") %>' />

    </td>

    </tr>

    <tr>

    <td>Straat:</td>

    <td>

    <telerik:RadTextBox ID="RadTextBoxStraat" runat="server" Skin="Office2010Blue" Width="100px"

    Text='<%# Eval("straat") %>' DisplayText="Geen straat gevonden"

    EmptyMessage="Geen straat gevonden" LabelWidth="40px" >

    </telerik:RadTextBox>

    </td>

    <td>Huisnummer:</td>

    <td>

    <telerik:RadTextBox ID="RadTextBoxHuisnummer" runat="server" Skin="Office2010Blue" Width="100px"

    Text='<%# Eval("huisnummer") %>' DisplayText="Geen huisnummer gevonden"

    EmptyMessage="Geen huisnummer gevonden" LabelWidth="40px" >

    </telerik:RadTextBox>

    </td>

    </tr>

    <tr>

    <td>Postcode:</td>

    <td>

    <telerik:RadTextBox ID="RadTextBoxPostcode" runat="server" Skin="Office2010Blue" Width="100px"

    Text='<%# Eval("postcode") %>' DisplayText="Geen postcode gevonden"

    EmptyMessage="Geen postcode gevonden" LabelWidth="40px" >

    </telerik:RadTextBox>

    </td>

    <td>Plaats:</td>

    <td>

    <telerik:RadTextBox ID="RadTextBoxPlaats" runat="server" Skin="Office2010Blue" Width="100px"

    Text='<%# Eval("plaats") %>' DisplayText="Geen plaats gevonden"

    EmptyMessage="Geen plaats gevonden" LabelWidth="40px" type="text" value="">

    </telerik:RadTextBox>

    </td>

    </tr>

    </table>

    </div>

    </ItemTemplate>

    </asp:FormView>

    <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:iControlConnectionString %>" SelectCommand="SELECT [account_adressenid], [accountid], [account_contactpersoon], [adres_account], [soort_adres], [adres_contactpersoon], [straat], [huisnummer], [postcode], [plaats], [land], [telefoon], [fax], [mobiel], [email], [notitie] FROM [account_adressen] WHERE (([accountid] = @accountid) AND ([account_adressenid] = @account_adressenid))">

    <SelectParameters>

    <asp:ControlParameter ControlID="Waarde" Name="accountid" PropertyName="Text" Type="Int32" />

    <asp:ControlParameter ControlID="AdresID" Name="account_adressenid" PropertyName="Text" Type="Int32" />

    </SelectParameters>

    </asp:SqlDataSource>

    </telerik:RadPageView>

    </telerik:RadMultiPage>

    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:iControlConnectionString %>" SelectCommand="SELECT [account_adressenid], [accountid], [straat], [huisnummer] FROM [account_adressen] WHERE ([accountid] = @accountid)">

    <SelectParameters>

    <asp:ControlParameter ControlID="Waarde" Name="accountid" PropertyName="Text" Type="Int32" />

    </SelectParameters>

    </asp:SqlDataSource>

    </telerik:RadPageView>

    <telerik:RadPageView ID="RadPageContactPersoon" runat="server">Contact Personen</telerik:RadPageView>

    <telerik:RadPageView ID="RadPageProjecten" runat="server">Projecten</telerik:RadPageView>

    <telerik:RadPageView ID="RadPageUren" runat="server">Uren</telerik:RadPageView>

    <telerik:RadPageView ID="RadPageOffertes" runat="server">Offertes</telerik:RadPageView>

    <telerik:RadPageView ID="RadPageFakturen" runat="server">Fakturen</telerik:RadPageView>

    </telerik:RadMultiPage>

    </telerik:RadPane>

    </telerik:RadSplitter>

    </telerik:RadPane>

    </telerik:RadSplitter>

    </asp:Content>

  6. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 08 Oct 2012 Link to this post

    Hello Willem,

     You could use the following approach in order to achieve the desired functionality:
    protected void RadTabStrip2_TabClick(object sender, RadTabStripEventArgs e)
           {
               RadTab TabClicked = e.Tab;
               AdresID.Text = TabClicked.Value;
           }

    All the best,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. Willem
    Willem avatar
    5 posts
    Member since:
    Oct 2012

    Posted 08 Oct 2012 Link to this post

    Thank you this works?



    Only one small question if I may?



    How can I display a street address when I click on  a Account? (This works)



    The account is in a RadGrid, then I show a RadTabStrip with Adressen, Contact Personen enz. (This works)

    Another RadTabStrip from a SqlDataSource with the name of the street. (This works)

    And then a page with the adres. This works only when I click on a tab with the address on it.



    This is the stuff inside the RadAjaxManager

    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">

        <AjaxSettings>

           <telerik:AjaxSetting AjaxControlID="RadGrid1">

              <UpdatedControls>

                 <telerik:AjaxUpdatedControl ControlID="RadGrid1" />

                 <telerik:AjaxUpdatedControl ControlID="Waarde" />

                 <telerik:AjaxUpdatedControl ControlID="RadTabStrip2" />

              </UpdatedControls>

           </telerik:AjaxSetting>

           <telerik:AjaxSetting AjaxControlID="RadPageAdressen">

              <UpdatedControls>

                 <telerik:AjaxUpdatedControl ControlID="RadTabStrip2" />

                 <telerik:AjaxUpdatedControl ControlID="RadMultiPage2" />

             </UpdatedControls>

          </telerik:AjaxSetting>

    </AjaxSettings>



    Greetings,

    Willem Visser

  8. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 11 Oct 2012 Link to this post

    Hello Willem,

    Could you elaborate a bit more on the experienced problem? What do you mean by the "This works only when I click on a tab with the address on it"?
    I have prepared a sample project for you, based on the provided code. Could you please update it with the exact your setup and send it back to us so we can investigate the problem locally?

    Greetings,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017