Hi ,
I am creating a column Image Button dynamical but when i click on image ItemCommand is not get Fired .
Below are the code
void GridUserControl_OnInitializeRow(RowEventArgs e){var objCustomItemTemplateEdit = new EditCustomItemTemplate();objCustomItemTemplateEdit.ID = "Edit_" + selectedSpecialty;e.Row.Items[3].Template = objCustomItemTemplateEdit;
var objCustomItemTemplateDelete = new DeleteCustomItemTemplate();objCustomItemTemplateDelete.ID = "Delete_" + selectedSpecialty;e.Row.Items[4].Template = objCustomItemTemplateDelete;}
public class EditCustomItemTemplate : ITemplate{public string ID { get; set; }public string CommandArg { get; set; }
public void InstantiateIn(Control container){ImageButton p = new ImageButton();p.ID = ID;p.EnableViewState = true;p.CommandArgument = CommandArg;p.CommandName = "Edit";p.ViewStateMode = ViewStateMode.Enabled;p.ImageUrl = "Edit.png";container.Controls.Add(p);}
}
public class DeleteCustomItemTemplate : ITemplate{public string ID { get; set; }public string CommandArg { get; set; }
public void InstantiateIn(Control container){ImageButton p = new ImageButton();p.ID = ID;p.EnableViewState = true;p.CommandArgument = CommandArg;p.CommandName = "Delete";p.ViewStateMode = ViewStateMode.Enabled;p.ImageUrl = "dele.png"p.OnClientClick = "return confirm('Are you sure you want to delete this record?');";container.Controls.Add(p);}}
Hi Zdravko Kolev,
Thanks for the sample code .
The sample code which you had provided had fixed column like OrderID, ShippedDate, ShipName , ShipCity etch but in my case based on xml template column will be created and shown ti the user.
In our project we will have one Custom Code which generate column based on xml template and same is shown to the user base on BL functionality like Edit , Delete or any more.
You can above mention logic code below mention link
http://ko.infragistics.com/community/forums/p/109368/514634.aspx#514634 (User Control)
http://ko.infragistics.com/community/forums/p/109460/515090.aspx#515090 (Helper Logic)
Thanks,
Santosh.
Hello Santosh,
I saw the issue on the sample that you provided, although I couldn't determine what is the cause of it, because the sample is very complex. So in order to debug the issue I've created a simplified sample based on your scenario, although the issue do not persist there. Could you try to reproduce the issue on the new sample attached to my reply.
The only thing that I've noticed is that page index changed server event was not fired, and this somehow could be related to the issue.
Getting issue when there is paging.
Its working fine but when i click on any page number then entire page is reloaded and then i click on image button item command event is not get fired and when i retry again then its work.
Thanks,.
This is strange, in the sample that I've sent you ItemCommand server event is fired again while constantly clicking the button.
Its working first time but again when i click on dynamic generated image button its not get fired .... :(
Santosh