ASPX templates
Version 4.x > ASPX templates > Datagrid delete event not firing up View modes: 
User avatar
Member
Member
r.sathishkumar1983-gmail - 5/4/2009 2:01:48 AM
   
Datagrid delete event not firing up
I created a blank page and added a web part (user control) in that page.. Inside the user control, I have added a datagrid that displays the data from a table. The datagrid has delete button as a column in each row. So, if I click the delete button at the end of each row, the corresponding row must be deleted. My problem is the datagrid_DeleteCommand event doesnt get fired when I click the delete button. The same user control works fine when I call it a from a web page(aspx page) created manually and not through CMS. Its not working only when I call the user control inside the page created using CMS.

Many many thanks for any help.

Regards,
Sathishkumar.R

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/7/2009 10:12:59 AM
   
RE:Datagrid delete event not firing up
Hi,

I have already sent an e-mail to you, I will post it also here for further reference.

You need to use your control inside the "User control" web part from General category. In this user control is the correct life cycle ensured.

The code behind could look like this :

 if (!this.IsPostBack) //this is in the Page_Load
{
this.NewsGrid.DeleteCommand += new DataGridCommandEventHandler(NewsGrid_DeleteCommand);
Binddata();

}

}

public void NewsGrid_DeleteCommand(object source, DataGridCommandEventArgs e)
{
Response.Write("delete hit");
}


public void Binddata()
{
//bind some data here to the grid
}



Best Regards,
Juraj Ondrus

User avatar
Member
Member
r.sathishkumar1983-gmail - 5/8/2009 1:54:06 AM
   
RE:Datagrid delete event not firing up
Dear Jurajo,
I tried ur idea. First,placed the user contol inside "CMSWebParts\MyWebParts" folder and created the web part under "General" category. Had no luck. Then I created the user control inside "CMSWebParts\General" folder and created web part under "General" category. Then also had no luck. When the delete button is clicked, page load event is getting fired. But after that, the delete event is NOT GETTING FIRED AT ALL.

Not sure whats the problem . May I know what do u mean by "use your control inside the "User control" web part" . Kindly help me in getting rid of this issue. Thanks for ur effort and help.

Regards,
Sathish Kumar.R

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/8/2009 4:37:41 AM
   
RE:Datagrid delete event not firing up
Hello,

I am sorry for the confusion, I meant the pre-defined built in web part named "User Control". In the General category of web parts, there is available this web part and also you can find similar example here.
I hope it will help to understand it more deeply.

Best Regards,
Juraj Ondrus