Hello,
I need to set the CommandArgument of a GridButtonColumn so it can be processed client-side. I tried to use the approach described at http://www.telerik.com/community/forums/aspnet-ajax/grid/commandargument.aspx but it doesn't seem work.
My GridButtonColumn definition is :
<telerik:GridButtonColumn CommandName="ConfigSl" Text="Configure SiteLink" UniqueName="ConfigSlBtn"> </telerik:GridButtonColumn>
My CodeBehind argument setter is :
protected void rgSite_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
GridDataItem item = e.Item as GridDataItem;
if (item != null)
{
string site = item.GetDataKeyValue("Code") as string;
LinkButton link = (LinkButton)item["ConfigSlBtn"].Controls[0];
link.CommandArgument = site;
}
}
My client-side Javascript, for now, is :
function RadGridCommand(sender, args)
{
var commandName = args.get_commandName();
var commandArgs = args.get_commandArgument();
var result = String.format("CommandName: {0}, CommandArgument: {1}", commandName, commandArgs);
alert( result );
if ( commandName == 'ConfigSl' )
{
args.set_cancel( true );
}
}
The commandArgs value I get for this is the row number, not the value set into the "Code" key. Also, I checked through the debugger and the Site variable into the ItemCreated event has the right value.
What am I doing wrong?
Thanks