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

Want to add LinkButton inside an edit form

1 Answer 47 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Kathy asked on 19 Sep 2010, 09:47 PM
I'm trying to use the standard edit form for a particular grid.  One of the columns in the edit form is a radcombobox.  What I want to do is to find the combo box and place a linkbutton next to it which will say something like "add new site".  When the click the linkbutton, I'll show a small window which will basically take just a text value.  When they save this info, it will make a new site, and the new site's id and name will show up in the combobox.  Can anyone help me?  Thanks.

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 2
answered on 20 Sep 2010, 02:18 PM
Hello Kathy,

Here is one sample application to achieve this scenario. I added the LinkButton in EditItemTemplate of TemplateColumn with RadComboBox. Then attach 'OnClientClick' event to the button inside RadWindow, and invoke ajaxRequest from the event handler. Now in the AjaxManager_AjaxRequest server event, get the corresponding RadComboBox in editform and update it.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
<telerik:RadWindow ID="RadWindow1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Save" OnClientClick="OnButtonClick();return false;" />
<telerik:RadGrid ID="RadGrid1" . . . .>
       . . . . . . . . . . . .
                    <telerik:RadComboBox ID="RadComboBox1" runat="server">
                         <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="OnLinkButtonClick();">add new site</asp:LinkButton>
       . . . . . . . . . . . . . . . .


protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       GridEditFormItem editItem = (GridEditFormItem)RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[Convert.ToInt32(RadGrid1.EditIndexes[0])];
       RadComboBox combo = (RadComboBox)editItem.FindControl("RadComboBox1");
       RadComboBoxItem item = new RadComboBoxItem(TextBox1.Text);

Java Script:
<script type="text/javascript">
    function OnLinkButtonClick() {
        var oWnd = $find("RadWindow1");;
        return false;
    function OnButtonClick() {
        var oWnd = $find("RadWindow1");

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 2
Share this question