Image button in Gridview
-
Hi All, I am adding one imagebutton in gridview using the "RowDataBound" method. But I could not able to found the onclick/runtat event.. How can i add this one ? ImageButton imgSortAssendingbyId = new ImageButton(); Thanks in Advance Dana
-
Hi All, I am adding one imagebutton in gridview using the "RowDataBound" method. But I could not able to found the onclick/runtat event.. How can i add this one ? ImageButton imgSortAssendingbyId = new ImageButton(); Thanks in Advance Dana
hi.. use this code in GVList_RowDataBound(...) Dim btnDel As ImageButton, btnUpd As ImageButton, lbexp As Label If e.Row.RowType = DataControlRowType.DataRow Then btnDel = CType(e.Row.FindControl("btnDelete"),ImageButton) btnDel.Attributes.Add("onclick", "return confirm_delete();") btnDel.CommandArgument = e.Row.RowIndex.ToString 'btnUpd = CType(e.Row.FindControl("btnUpdate"), ImageButton) 'btnUpd.CommandArgument = e.Row.RowIndex.ToString End If
-
hi.. use this code in GVList_RowDataBound(...) Dim btnDel As ImageButton, btnUpd As ImageButton, lbexp As Label If e.Row.RowType = DataControlRowType.DataRow Then btnDel = CType(e.Row.FindControl("btnDelete"),ImageButton) btnDel.Attributes.Add("onclick", "return confirm_delete();") btnDel.CommandArgument = e.Row.RowIndex.ToString 'btnUpd = CType(e.Row.FindControl("btnUpdate"), ImageButton) 'btnUpd.CommandArgument = e.Row.RowIndex.ToString End If
Thanks for the reply.. You are in the retriving phase. I am asking how to add a server control to the header ?
-
Hi All, I am adding one imagebutton in gridview using the "RowDataBound" method. But I could not able to found the onclick/runtat event.. How can i add this one ? ImageButton imgSortAssendingbyId = new ImageButton(); Thanks in Advance Dana
Hi Dana, I assume you have already added the ImageButton to the GridView. And here is how you do the rest. The GridView's RowCommand event will fire when you click on that ImageButton in the GridView. That is in your code imgSortAssendingbyId. (This command basically fires for any button’s click event, in the GridView). Example:- protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { Response.Write("You Clicked the Button"); } Thx, Gayani
-
Thanks for the reply.. You are in the retriving phase. I am asking how to add a server control to the header ?