In my gridview some rows are already presents. Gridview have one column containing link button. But when I add new row in gridview I want to change the text of that link button for that new row only.
Thanks in advance.
In my gridview some rows are already presents. Gridview have one column containing link button. But when I add new row in gridview I want to change the text of that link button for that new row only.
Thanks in advance.
Look at your gridview events, you can access specific row attributes in the event handlers.
For example, RowCreated: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcreated.aspx
GridView doesn't support inserting a new row like the way we update/Delete a row.This means that There is NO such BuiltIn functionality for Inserting a row. Obviously there are workarounds for this problem. You may say there is a
RowCreated
Event of GridView, however this event is raised when GridView renders itself and is seen closely related toRowDataBound
.The easiest way to get hands on inserting a new row is using the DetailsView.
DetailsView:
Add a CommandField inside
<Fields>
section of Details view as below:You also need to have a
SqlDataSource
control as below:However, still if you want to use grid View only using some workarounds, below link is worth seeing: http://aspsnippets.com/Articles/Adding-Dynamic-Rows-in-ASP.Net-GridView-Control-with-TextBoxes.aspx