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

[Solved] pass parameter in radgird link button

4 Answers 523 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 24 Apr 2013, 07:34 AM


<telerik:TreeListTemplateColumn>
                               <ItemTemplate>
                                   <asp:LinkButton ID="ImageButton" Text="Delete" CommandName="Delete" runat="server"
                                       OnClientClick="if (!confirm('Please Confirm to Delete?')) return false;" CommandArgument='<%#Eval("WorkDescription") %>' HeaderStyle-Width="20px" />
                               </ItemTemplate>
                           </telerik:TreeListTemplateColumn>

see attachment ,
commandargument name also come that alert ,
how i achieve this one.

Thanks Advance,
Mohamed.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2013, 07:57 AM
Hi,

Try the following code to achieve your scenario.
aspx:
<telerik:RadTreeList DataKeyNames="ID"  ...>

c#
protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
 if (e.Item is TreeListDataItem)
 {
        TreeListDataItem item = (TreeListDataItem)e.Item;
        LinkButton link = (LinkButton)item.FindControl("ImageButton");
        string value = item.GetDataKeyValue("ID").ToString();
        link.OnClientClick = "OnClientClick('" + value + "');return false;";
  }
}
JS:
function OnClientClick(value) {
      if (!confirm('Please Confirm to Delete?'+value));
  }

Thanks,
Shinu
0
mohamed
Top achievements
Rank 1
answered on 24 Apr 2013, 08:23 AM
Thanks For Ur reply Shinu,

but no passed to deletede_command

RadTreeListWork_DeleteCommand

Thanks Advance,
Mohamed.
0
Shinu
Top achievements
Rank 2
answered on 25 Apr 2013, 05:04 AM
Hi,

As far as I know you can add onclick attribute to linkbutton in Attributes collection and relate it to confirm dialog passing the value from the chosen cell value in the ItemDataBound event of the treelist. Hope this helps.

Thanks,
Shinu
0
mohamed
Top achievements
Rank 1
answered on 25 Apr 2013, 05:31 AM

Thanks For Ur reply ,
but only OnClientClick Attributes only for radtreelist no onclick Attributes what i do now

Thanks Advance,
Mohamed.
Tags
Grid
Asked by
mohamed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
Share this question
or