This is a migrated thread and some comments may be shown as answers.

Raise LinkButton Event from Combobox ItemTemplate

8 Answers 25 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
omer
Top achievements
Rank 1
omer asked on 15 Sep 2015, 07:17 AM

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?

 

8 Answers, 1 is accepted

Sort by
0
Atif
Top achievements
Rank 1
answered on 15 Sep 2015, 08:57 AM
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";
    }
0
omer
Top achievements
Rank 1
answered on 15 Sep 2015, 09:49 AM

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.

0
omer
Top achievements
Rank 1
answered on 15 Sep 2015, 09:50 AM
By the way checkbox event working properly.
0
Atif
Top achievements
Rank 1
answered on 15 Sep 2015, 11:08 AM

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
    }

0
Atif
Top achievements
Rank 1
answered on 15 Sep 2015, 11:10 AM
I just removed command Events.
0
omer
Top achievements
Rank 1
answered on 15 Sep 2015, 11:25 AM
only checkbox event raising even tried your posted code.
0
Atif
Top achievements
Rank 1
answered on 15 Sep 2015, 11:32 AM
0
omer
Top achievements
Rank 1
answered on 15 Sep 2015, 01:19 PM
Added "CausesValidation="false" and its ok. 
http://www.telerik.com/forums/radbutton-onclick-event-won-t-fire
Tags
Ajax
Asked by
omer
Top achievements
Rank 1
Answers by
Atif
Top achievements
Rank 1
omer
Top achievements
Rank 1
Share this question
or