Rad Pane and DIV

5 posts, 1 answers
  1. SKande
    SKande avatar
    27 posts
    Member since:
    May 2013

    Posted 03 Jun 2013 Link to this post

    Hello
       I am new in using Telerik Radpane control I am having a problem in accessing server controls which are inside a div which is present in radpane. I am not able to access them in my codebehind file, there are compilation errors like the name is not present in the current context for the same aspx page code behind file. How do we access asp controls inside a panel bar item template which has a radpane.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2013 Link to this post

    Hi,

    I have tried to access the controls inside RadPane and it worked as expected on my end. Please have a look into the following code.
    ASPX:
    <telerik:RadSplitter ID="RadSplitter1" runat="server">
     <telerik:RadPane ID="RadPane1" runat="server">
      <div>
        <asp:Button ID="Button1" runat="server" Text="test" />
      </div>
     </telerik:RadPane>
    </telerik:RadSplitter>
    C#:
    protected void button2_Click(object sender, EventArgs e)
     {
         Button1.Text="change"; //directly accessing with ID
     }

    Hope this will help you.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. SKande
    SKande avatar
    27 posts
    Member since:
    May 2013

    Posted 06 Jun 2013 Link to this post

    Hello Shinu thank you for the reply actually my controls are inside a radpanelBar inside a radpanel item and i have gone through accessing asp controls inside a radpanel i am able to access them using a typecast and Find Control method but there is div section inside radpanel which is i am unable to access because there is no asp control that is called "div".


    <radpanelbar>

     <radpanelitems>
     <itmes>
     <radpanel item >
       < radslitter>
          <radpane>
                   <div id="123">
                    <imagebutton>
      </radpane>
    </radsplitter>


    How can we change the style of that div and et that asp control.

  5. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2013 Link to this post

    Hi,

    Try the following code snippet.

    ASPX:
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server">
     <Items>
     <telerik:RadPanelItem runat="server" Value="itemHolder">
     <ItemTemplate>
     <telerik:RadSplitter ID="RadSplitter1" runat="server">
     <telerik:RadPane ID="RadPane1" runat="server">
     <div id="div1" runat="server">
       <asp:Button ID="Button2" runat="server" Text="test" />
     </div>
    </telerik:RadPane>
     </telerik:RadSplitter>
     </ItemTemplate>
     </telerik:RadPanelItem>
    </Items>
    </telerik:RadPanelBar>
    <asp:Button ID="Button1" runat="server" Text="click" OnClick="Button1_Click" />

    C#:
    protected void Button1_Click(object sender, EventArgs e)
    {
     RadSplitter rd = (RadSplitter)RadPanelBar1.FindItemByValue("itemHolder").FindControl("RadSplitter1");
     System.Web.UI.HtmlControls.HtmlGenericControl div = (System.Web.UI.HtmlControls.HtmlGenericControl)rd.FindControl("div1"); // to access htmlcontrols in c#
     Button Button1= (Button)rd.FindControl("Button2");
    }

    Hope this will help you.

    Thanks,
    Shinu.
  6. SKande
    SKande avatar
    27 posts
    Member since:
    May 2013

    Posted 07 Jun 2013 Link to this post

    Perfect !!.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017