Raise LinkButton Event from Combobox ItemTemplate

9 posts, 0 answers
  1. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 15 Sep 2015 Link to this post

    Hello,

    I've delete button with onClick event in my combobox itemtemplate but never raising. 

    Googled but no any example found. 

    How can I use LinkButton with event in ComboBox ItemTemplate?

     

  2. Atif
    Atif avatar
    18 posts
    Member since:
    Jul 2015

    Posted 15 Sep 2015 in reply to omer Link to this post

    In radcombox properties "OnClientSelectedIndexChanging" call JS function Select. 
    and in select call linkbutton click event using its id.

     

    <script type="text/javascript">
           function Select(sender, evenArgs) {
             document.getElementById('<%= btnlink.ClientID %>').click();
        }
     
    ***************************************************************************
    <telerik:RadComboBox ID ="rad123" runat="server" OnClientSelectedIndexChanging="Select" >
                        <Items>
                            <telerik:RadComboBoxItem Text="123" />
                             <telerik:RadComboBoxItem Text="12321" />
                            <telerik:RadComboBoxItem Text="value" />
                        </Items>
                    </telerik:RadComboBox>
                    <asp:LinkButton ID="btnlink" OnClick="btnlink_Click" runat="server"></asp:LinkButton>
                    <asp:TextBox ID="text" runat="server"></asp:TextBox>
     
    ***********************************************************************
    protected void btnlink_Click(object sender, EventArgs e)
        {
            text.Text = "12312321";
        }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 15 Sep 2015 in reply to Atif Link to this post

    Thank you for answer Atif,

    My LinkButton inside of ComboBox ItemTemplate. 

    I want to let delete to user items which. Bu link button doesnt firing OnClick Event.

    <itemtemplate>
    <td width="38" rowspan="11" valign="middle">
    <p>
    <asp:CheckBox runat="server" ID="test" Text="delete" OnCheckedChanged="test_CheckedChanged" AutoPostBack="true" />
    <asp:Button runat="server" ID="LinkButtonDelete" Text="Delete" Visible="true" Width="50"  OnClick="LinkButtonDelete_Click1"                                                                    Font-Size="Large" Font-Bold="true"  OnCommand="LinkButtonDelete_Command" CommandName="Delete" />                                                                        CommandArgument='<%# DataBinder.Eval(Container.DataItem, "AdressId")%>' ForeColor="Gray"> </Button >
    </p>
    </td>
    </itemtemplate>
    populated.

  5. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 15 Sep 2015 in reply to omer Link to this post

    By the way checkbox event working properly.
  6. Atif
    Atif avatar
    18 posts
    Member since:
    Jul 2015

    Posted 15 Sep 2015 in reply to omer Link to this post

    Your code is working fine at my end. Event is raised on Click.

    <telerik:RadComboBox ID="rad123" runat="server">
                   <Items>
                       <telerik:RadComboBoxItem Text="123" />
                   </Items>
                      <ItemTemplate>
                        <td width="38" rowspan="11" valign="middle">
                            <p>
                                <asp:CheckBox runat="server" ID="test" Text="delete"  OnCheckedChanged="test_CheckedChanged" AutoPostBack="true" />
                                <asp:Button runat="server" ID="idbtn"  Text="Delete" Visible="true" Width="50" OnClick="LinkButtonDelete_Click"  />
                            </p>
                        </td>
                    </ItemTemplate>
                </telerik:RadComboBox>
                <asp:TextBox ID="tex" runat="server"></asp:TextBox>
     
    *******************************************************
      protected void LinkButtonDelete_Click(object sender, EventArgs e)
        {
            tex.Text = "1231232";
           // tex.Text=rad123.SelectedValue;
        }
     protected void test_CheckedChanged(object sender, EventArgs e)
        {
    //Do somthing
        }

  7. Atif
    Atif avatar
    18 posts
    Member since:
    Jul 2015

    Posted 15 Sep 2015 in reply to omer Link to this post

    I just removed command Events.
  8. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 15 Sep 2015 in reply to Atif Link to this post

    only checkbox event raising even tried your posted code.
  9. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 15 Sep 2015 in reply to Atif Link to this post

    Added "CausesValidation="false" and its ok. 
    http://www.telerik.com/forums/radbutton-onclick-event-won-t-fire
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017