Hello
I am programming in C#, vis studio 2003 using UltraGrid V6.2I would like to have an image button in a particular cell on some rows and not others.
I found and am trying to implement code found at kb article KB04876 , sample webgrid_advanced_dynamic_column_templates_2005v1_cs.zip
Creating the button when needed appears to work well. Although the correct image is assigned and toolTip, etc.. the line of code to set the image button Click event does not appear to be doing anything: Here is my code for creating the buttons. By the way, the client side onclick event does work, but I need the server side event to fire.
Infragistics.WebUI.UltraWebGrid.TemplatedColumn col = (TemplatedColumn) UltraWebGrid2.Columns.FromKey("action"); if(e.Row.Cells.FromKey("UI_STATUS_CODE").Value.ToString() == "NEW") { ImageButton ib = (ImageButton)((CellItem)col.CellItems[e.Row.Index]).Controls[0]; ib.ID = "imgbtn_" + e.Row.Index.ToString(); ib.ImageUrl = "images/approve.gif"; ib.ToolTip = e.Row.Index.ToString() + " my tooltip"; ib.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButtonClickHandler); ib.Attributes.Add("onclick","ImageButton_Click(" + e.Row.Index + ");"); }
I have created the procedure ImageButtonClickHandler but it never fires.
What else is needed to get this to work?
Thanks
Jeff
OK, I had the line to add hte click event commented out in the CreateChildControls() event. (not sure what happened there)
However, Now, the ImageButtonClickHandler(...) event handler does not fire on the first time the user clicks the button (other events fire and there is a postback, but not for this event), but it does fire on all subsequent button clicks.
What can cause it to not work the first time a user clicks, but all other times?
thanks again
jeff