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

Client side retrieve key oncommand

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 09 Mar 2009, 03:49 PM
I am doing a delete of a row on client side. I have an oncommand set up so that if the delete button is clicked, I first want to pop up a rad window giving the user a choice of what type of delete they wish to do.

In the oncommand client side, how do I know what row the user has clicked on the delete icon? I do not have client row selected set.

Thanks,
Laura

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Mar 2009, 11:13 AM
Hi Laura,

Try the following approach to pass the key value for the clicked row on the client side.

ASPX:

<
telerik:GridButtonColumn Text="Delete" ButtonType="linkButton" UniqueName="BtnColumn" HeaderText="BtnColumn" ></telerik:GridButtonColumn> 


CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            LinkButton lnkbtn = (LinkButton)item["BtnColumn"].Controls[0]; 
            string strKey = item.GetDataKeyValue("ProductName").ToString(); ; 
            lnkbtn.Attributes.Add("OnClick""Show('" + strKey + "');"); 
            
        } 
 
    } 


JS:
<script type="text/javascript" > 
 
function Show(strKey) 
  
 confirm('You wish to delete row ' +  strKey ); 
</script> 
 


Thanks
Shinu

Tags
Grid
Asked by
Laura
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or