Click here to Skip to main content
15,913,213 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
im having two columns(Country_id,country_name)...if click row editing button the data will display in the textbox inside the grid view for editing...i want to edit only country_name and i dont want to edit country_id..when i click the edit button country_id has to be displayed in label..i want the coding for that..
Posted

ok for that you should make country_id readonly....<br />
Go to properties of gridview, select columns and select first Coloumn(id) and make readonly true....<br />
or <br />
you can apply this property dynamically in load_event...<br />
 
Share this answer
 
Hi!
You have to set in asp code that field country_id is read only. and insert visible value to false so that user can not edit it.

ASP
<asp:boundfield datafield="country_id" headertext="country_id" insertvisible="False" readonly="True" sortexpression="country_id" xmlns:asp="#unknown" />


Thanks.
 
Share this answer
 
Here is The Solution..

Define CustomerID Field as follows..

Inside EditItemTemplate
<columns>
<asp:TemplateField HeaderText="Country ID" >
 
<itemtemplate>
    <%#Eval("Country_id")%>
</itemtemplate>
 
<edititemtemplate>
   <asp:Textbox id="txtCountry_id" runat="server" Enabled="false">
         Text='<%#Eval("Country_id")%>'>
</edititemtemplate>
 

</columns>

Later If You Will Have Doubts Just Replay Me...
 
Share this answer
 
v4
You can use GridView's EditItemTemplates for this.
 
Share this answer
 
Comments
premkumar.r 13-Jun-11 7:36am    
instead of using edit item template how can we generate the table
premkumar.r 13-Jun-11 7:37am    
instead of using edit item template how can we generate the label

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