Click here to Skip to main content
14,738,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one editable gridview ,i have use item templete and edit templete for declaring columns for 4 columns and boundfield for one column,my problem is wheever i am clicking edit button the bounded feild item also becomes editable(ie gets converted into textbox) is there any solution to avoid this? i want boundedfeild to remain uneditable
Posted
Comments
supermario ballotelli 26-Mar-12 2:55am
   
i have tried other way,i took a column in sharepoint doc library as Date which has only date but after binding it with label its showing time also

One way that i know is
Use Item template field and in edit item template use Label to show your data,so it will be in read mode in editable mode.
   
Comments
supermario ballotelli 26-Mar-12 2:53am
   
ya,but the problem is that i am binding date columns which cointains date and time,when i m binding its showing both date and time in column,to avoid this i used bounded feild where i am showing just a date
while using an editable grid view avoid using boundfeild (even if you want to display value in formated way,ie in my case i wanted to eliminate time section from time and date) because when u click edit button OnRowEditing Event the bound feild also becomes editable to avoid this use templete feilds and bind the value to a label,formating can be done by setting text property as
Text=<%#string.Format("{0;d},Eval("Column Name"))%>>
   
Use the following code will help you to sort out your problem.

Text=<%#string.Format("{0;d},Eval("Columnname"))%>>
   
GridView Edit Update Using BoundField
http://patilranjeet.blogspot.in/p/aspnet-gridview-edit.html
   

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