Wednesday, March 21, 2012

Urgent Please Help

Thanks for taking time in reading this thread.

I have Gridview contorl inside Update panel

Gridview in dynamic and I have added EditTemplateField to this grid.

When I click on Edit button , page flickers and it does not go into edit event.

I am not using sqldatasource or objectdatasource, I have custom classes.

What do you think is the problem ?

Again Thanks.

For reference here is the code

**************************************Code to create Edit button**************************************

TemplateField templateFieldEdit =newTemplateField();

templateFieldEdit.ItemTemplate =newReportViewHelper(ListItemType.Item, ReaderColumn[ReportViewHelper.ColumnDBName].ToString().Trim(),"Command");

**************************************Design Edit Button**************************************

elseif (_columnControlType =="Command")

{

ImageButton edit_button =newImageButton();

edit_button.ID ="edit_button";

edit_button.ImageUrl ="~/Images/edit.gif";

edit_button.CommandName ="Edit";

edit_button.Click +=newImageClickEventHandler(edit_button_Click);edit_button.ToolTip ="Edit";

container.Controls.Add(edit_button);

}

************************************** this is the method that is not triggering *************************************

void edit_button_Click(object sender,ImageClickEventArgs e)

{

}

Take a look at this articlehttp://aspalliance.com/1125_Dynamically_Templated_GridView_with_Edit_Delete_and_Insert_Options. It's real helpful for creating dynamic templates...

-Damien

No comments:

Post a Comment