Click here to Skip to main content
15,915,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a gridview in asp.net for adding purchased items to the invoice bill. i have add button in the footer row to add rows in the gridview. And i have save button outside the button, after adding all the purchased items inside the gridview i have to click the save button to save all the gridview rows into the DB. The biggest problem i have is, while entering the details the gridview columns will be having editable controls like textbox, checkbox and dropdownlist, after clicking the add button, all the controls has to be changed into non editable controls like label.. This is the task given to me and i couldnt able to do,, so please help me..
Posted
Updated 16-Aug-13 9:25am
v2
Comments
Richard C Bishop 16-Aug-13 15:05pm    
So what you need to do is convert your fields that you want different controls in to templated fields. You will edit your templates and add the controls you want. There are plenty of examples on the web to look at.
Manikandan K 18-Aug-13 13:33pm    
but in all the codings i found in web, they have all the controls in the footer itself. but in my case, i have only add btn in the footer.. And its very difficult for me to change editable control(txtbox, ddl, checkbox etc) to non editable controls(lbl).. so if you have a code, please send me.. i m really struggling...
TryAndSucceed 16-Aug-13 18:34pm    
Are you dynamically creating your gridview? Because if you are, then your problem can be easily solved.

1 solution

In AddButton_Click() event try to assign gridview id enabled to false. ie., For example your gridview id is gridview1 then add the following code in AddButton_Click() event in .cs file. You could see all the editable controls are disabled as non-editable.

gridview1.Enabled = false;
 
Share this answer
 
Comments
Manikandan K 18-Aug-13 13:34pm    
i found several codings in web, but in all the codings, they have all the controls in the footer itself. but in my case, i have only add btn in the footer.. And its very difficult for me to change editable control(txtbox, ddl, checkbox etc) to non editable controls(lbl) after the addbtn_click() event.. so if you have a code, please send me.. i m really struggling...
bluesathish 19-Aug-13 1:36am    
Is my posted solution is not a solution you looking for?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900