KaranGupta
asked on
NewText is not working
Hi
I have a grid view in which I have a commandfield (please check the code section)
My requirement is when I add a new record in the grid the text should be add and when I update the existing row the text should be update. I have tried to use NewText as well. But I am not able to get the desired result.
Am I missing something.
Kindly advice
Regards
Karan Gupta
I have a grid view in which I have a commandfield (please check the code section)
My requirement is when I add a new record in the grid the text should be add and when I update the existing row the text should be update. I have tried to use NewText as well. But I am not able to get the desired result.
Am I missing something.
Kindly advice
Regards
Karan Gupta
<asp:CommandField HeaderText = "Edit" EditText = "Edit" CancelText = "Cancel" ShowEditButton = "true" UpdateText = "Update" ControlStyle-CssClass = "LinkButton"/>
ASKER
Hi
I am not getting the information I need. Could you please tell me where is it.
Regards
Karan Gupta
I am not getting the information I need. Could you please tell me where is it.
Regards
Karan Gupta
Hi Karan,
You can not do what you want with CommandField.
CommandField is only for Edit/Delete/Update/Cancel.
For adding new record you can add another button.
You can not do what you want with CommandField.
CommandField is only for Edit/Delete/Update/Cancel.
For adding new record you can add another button.
ASKER
Hi
I think I was not able to elaborate the question well. I don't want functionality but what I want is when the user adds new record in the gridview then text of update Link should be "Add" and if updating the existing record then it should be "update". Please let me know in case of any other information.
Regards
Karan Gupta
I think I was not able to elaborate the question well. I don't want functionality but what I want is when the user adds new record in the gridview then text of update Link should be "Add" and if updating the existing record then it should be "update". Please let me know in case of any other information.
Regards
Karan Gupta
The GridView does not have feature to add records using New button. You need to use DetailsView to have a form to add records and display it in GridView.
If you want to display 'New' button, you need to use CommandField.ShowInsertBut ton Property. But this property applies only to data-bound controls that support insert operations, such as the DetailsView control.
Try the following examples
Detailsview: insert / update single record
http://www.devx.com/dotnet /Article/2 2141/0/pag e/4
Inserting new row in GridView in ASP.NET 2.0
GridView extras - DetailsView
If you want to display 'New' button, you need to use CommandField.ShowInsertBut
Try the following examples
Detailsview: insert / update single record
http://www.devx.com/dotnet
Inserting new row in GridView in ASP.NET 2.0
GridView extras - DetailsView
ASKER
Hi
I just want to rename update button at run time. Is that possible.
Regards
Karan
I just want to rename update button at run time. Is that possible.
Regards
Karan
try at OnRowDataBound event, access that button / link and assign new text value.
ASKER
How can we access that
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
see this example:
http://msdn.microsoft.com/en-us/library/ms972948.aspx