how to disable editing for some of the value in the gridview when edit function is clicked

hi, could anyone tell me how to disable the values for the gridview.
6/13/2008 9:27:12 AM 72751 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 16
Get it on Google Play
Get it on Apple App Store


you can convert it to a template field (ie the column thta you want people to not change)
then you can change the textbox to a label control in the edititem templated field.

Does that make sense?

example below...

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"

DataSourceID="SqlDataSource2" Style="position: relative">


<asp:CommandField ShowEditButton="True" />

<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"

SortExpression="id" />

<asp:TemplateField HeaderText="region" SortExpression="region">


<asp:Label ID="TextBox1" runat="server" Text='<%# Bind("region") %>'></asp:Label>



<asp:Label ID="Label1" runat="server" Text='<%# Eval("region") %>'></asp:Label>



<asp:BoundField DataField="includes" HeaderText="includes" SortExpression="includes" />



6/13/2008 11:15:57 AM

 How do i do tt??

6/16/2008 12:50:50 AM

Hi x_Vynel ,

For examle,


                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("countryname") %>'></asp:TextBox>
Above inline code will let customer to edit the value of textbox. You can change it to :
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("countryname") %>'></asp:Label>
So customer can not edit the value of textbox.

Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
6/16/2008 4:44:16 AM

Similar Artilces:

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

Is there really an easy way to click and edit a cell value at run time (without having to click on Edit and Update links) in GridView?
 Link for an answer is broken. Anyway I want know just that. RegardsLeif  I'm talking with absolutely no knowledge, but why not to trigger "onblur" event in the client textbox and forward it to whatever the edit-and-update links go?...

Direct editing of gridView or Ddatagrid controls without clicking on an EDIT link
I have an application where lots of data is presented to the user in a gridView control and the user needs the option to review and overwrite any values in the cells of the grid.  My users find it very annoying and time consuming to click on an edit link to turn a row of the gridView into edit mode.  Typically, they might jump around and edit a few values in several rows.  Is there any way to present the data in a gridView control, datagrid control or something that looks like a grid where the entire grid is already in edit mode?  Can you make a grid that cont...

GridView control enters edit mode only when I click Edit link twice
Hi all..I have a GridView control in an ASP.NET 2.0 page. I added a column that contains edit, update, cancel buttons. Because I did that, I had to handle RowEditing event or an exception was thrown.Well... this is the body of the RowEditing event:protected void gvParametros_RowEditing(object sender, GridViewEditEventArgs e){      gvParametros.EditIndex = e.NewEditIndex;}The fact is that when page is loaded and I click the edit link, page is refreshed but GridView doesn't enter edit mode. When I press edit link again, GridView enters edit mode.Any help to solve this behavior w...

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Gridview Edit
Hallo, sorry for my bad english, but i try to describe my problem. I've an Gridview and Entries, everything is OK. Now i want that during edit one Row, that all the other Rows are disabled, that the user have to click the Edit or Cancel Button. He can't select another one. Is there any posibility to Disabled the other rows?There are: RowCancelingEditgrvAnzeige.Rows[i].Enabled = false;Should i use a loop, or is there a easier posibility!?Thx and sorry for my bad english. ;)Knut Do you want to make sure no other rows can be selected during a row is in edit mode? i...

GridView: editing without clicking edit link
Hi guys, I'd like to edit the content of the gridview without using 'edit' link. User can just click the cell and edit the data. Any links or thoughts would be appreciate.I can do it! Well, I have not tried but take a look at this: Other than these, there are 3rd party grids which let you do MS Excel like editing. A Google search will help.Mark replies as answers if they helped you solve the problem. I don't want to pay for the control. Googled, but no luck. Any ideas?I can do it! ...

editable gridview when user click external edit button
Hi Friend, I have gridview with columns id, fname, lname and email. I have bound the gridview from the table. Now my requirement is: I need to have editable gridview with edit button external to gridview. I can do it, if the edit button is internal to gridview. But I want to achieve editable gridview when user click external edit button. Is it possible or any other control that have this future?  Thanks, FarooqMark as answer if this post helpfull to you.Don't be afraid to be wrong; otherwise you'll never be right.  Do you want to make a certain row editable or t...

To edit or no to edit
Jon, Can I edit, whatever I've written so far, so that it doesn't look like I wrote utterly crap?-) -- Pieter "Linux is like living in a teepee. No Windows, no Gates, Apache in house." -- Usenet signature Pieter Zijlstra wrote: > Jon, > > Can I edit, whatever I've written so far, so that it doesn't look like > I wrote utterly crap?-) Oh boy, the edit button vanished from the web-forum ... ;-) -- Pieter "Humor is also a way of saying something serious." -- T. S. Eliot (1888 - 1965) Pieter Zijlstra wrote: ...

How to control display and edit values in a GridView
I am pretty much a beginner to ASP.NET. I have watched about 40 hours worth of videos,  which I must admit are very helpful, and read about 100 threads of messages from these forums. I have been able to build a web-site with some very basic database editing. What I am trying to do is this. I have defined an enum... public enum PersonalDayTimeCode { day, am, pm } I have a database table with a Date column of type DateTime and a TimeCode column of type int which will hold the ordinal value of a PersonalDayTimeCode defined above. I have a LINQToSQL datasource bound to t...

Edit but no edit
I've Created a custom module and reuse the survey.dnn file to help with the install here it is. <?xml version="1.0" encoding="utf-8" ?> <dotnetnuke version="2.0" type="Module"> <folders> <folder> <name>CompanyName - Photos</name> <description>Photos allows you to add photo albums</description> <version>01.00.00</version> <modules> <module> <friendlyname>CompanyName - Photos</friendlyname> <controls> <c...

Editable/Not Editable
Hello All, I have some webform(.aspx page) in which i have some controls (for input) and i would like to make that screen editable/not editable based on some condition. how can i do that.  the whole intent is user can read the information but can't change.  shiva kumar If you want to make the controls editable/non-editable, you can set their ReadOnly property to true or false accordingly. What exactly do you imply by making the screen editable/non-editable?Thanks,MaxLet Me Google That For You! i mean to say i would like to show the current values but user should not modify them. ReadOnly property is the way to go...Thanks,MaxLet Me Google That For You! Thanks bullpit. You can do it with javascript:   document.getElementById('TextBox1').readOnly = true;  Hope this helps!  Don't forget to mark the most helpful post(s) as Answer for the sake of future readers.  Thanks!Josh Stodola ← Come check out my blog!...

Select Value of Gridview Template Control During Edit
Im trying to access the value of a textbox within a template field during edit mode so that I can update that record. I had it working before I converted the columns to template fields, but I changed it so I could control the width of the gridview once if was in editmode. (Wasnt sure if there was any other way to stop it expanding.) I have this code;  myValue = DirectCast(Gridview1.Rows(0).Cells(1).FindControl("Textbox1"), TextBox).Text  This only works on the first record of my gridview. Im assuming because of the "Rows(0)". Any other record I get; Object...

get edit template control value in Gridview
 I have a gridview that has two edit item templates which have controls textbox and a label I want to get the value of the controls when I update the gridview and add that to the update parameters. I keep getting object reference not set to an instance of an object for the label and the textbox. I cannot figure this out.I can't believe this has stumped me as I know I have done it before and it is very simple I must be over looking something. here is my vb here is my vb Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewU...

Gridview Edit go to new page and enter Edit mode on a formview control.
Okay, so far I have the edit button go to a page called update.aspx. And have the ID selected. However, I don't want it to be in selected view, I want it to go to the update.aspx page in edit mode not selected mode. Is this possible? You can add one hyperlink and set its path to update.aspx?Id=(selectedId)on update.aspx read Id's value from querystring and do updation - Hardik (Software Developer,Surat,India)Please remember to click "Mark as Answer" on this post if it helped you. You lost me at the "do updation part" so far I have a the EDIT link go to ...

IWDBEdit control set to IWDBGridColumn.Control not editable [Edit]
Hi folks. I'm relatively new to IntraWeb and am having trouble with my application. It is a simple app that is supposed to show a list of user accounts in a grid and allow the user to edit data in the accounts. I have a TADOQuery connecting to MS SQL, with 'Select * from UserAccounts' as the sql text. I have a TDataSource with the Dataset property pointing to my TADOQuery object. Both of these objects exist as part of the UserSession. On my main form, I have an IWDBGrid, IWDBNavigator, and an IWDBEdit control. They are all hooked up to the TDatasource in the UserSessi...

Editable Child GridView inside editable parent gridview
Hi,  I need help writing a Paent/Child gridview combination. I need an editable parent gridview, inside templatefield of parent grid view I need an editable child gridview. Can any one post sample code. Hi jameston ,   <form id="form1" runat="server"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" DeleteCommand="DELETE FROM [country] WHERE [countryid] = @countryid" InsertCommand="INSERT INTO [co...

Whith highlighting/selecting a row functionality I cannot edit the text boxes after clicking the edit command
The gridview row gets highlighted when hovering the pointer or clicking on a row. However, the tooltip for the edit/cancel/update buttons are not shown and when I click the edit button, the textbox for each field does not show a cursor so I can't edit. The code below shows the javascript for the mouse styles, asp for the edit template field and c# code. If I don't use the highlighting row functionality, i can edit the fields as per normal. Does anyone else come across this?<script language="javascript" type="text/javascript"> var oldgridSele...

how to obtain old value in gridview after edit button clicked
my gridview has a column for employee name.  the template field/item template for this field is a label databound to an objectdatasource.  when the user clicks the edit command button, the edititemtemplate converts to a listbox databound to a different ODS so that the user is limited to employees in the database. i'd like to be able to determine if the user changed the employee name.  something like comparing the current employee name, via the listbox, with the previous value, via the label.  i've even tried saving the datatable to Session state and...

GridView and Javascript
Hey All, I need help from  you. I have a GridView. In the  Edit Item template of the first Column I have a textbox, an user control and hidden field. When I click on the user control it  opens a pop up from which I can choose the required value. The text value is populated in the textbox and Id in the hidden field. Here's the code for edit template.         <EditItemTemplate>                        <table cellpaddin...

How do I fix a Edit GridView Error
Hello, I keep getting this error when I edit and update a gridview.   Server Error in '/Albers_website' Application. Updating is not supported by data source 'SqlHAPSource' unless UpdateCommand is specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotSupportedException: Updating is not supported by data source 'SqlHAPSource' unless UpdateCommand is specified.Source Error: [NotSupporte...

Not able to set value to dropdownlist on gridview click in edit mode,and Pageload
In my form i have two textboxes and an dropdownlist and an gridview to dispaly the data, In edit mode when i click the gridview ,im assigning the values of the particular row to the text box and  dropdownlist,  the problem is, not able to set the selected value to dropdownlist on the first clik itself, during the first click getting the other two values to the textbox but not in the dropdown list, when i click the gridview for the second time i m able to get the value to the dropdownlist correctly,protected void GridView1_SelectedIndexChanged(object sender, EventArgs ...

Calendar Control bound to Gridview not updating value on "Edit"
I have a calendar control bound to a gridview that is bound to a smalldatetime field in a sql server 2005 database.  It is coming over as null but I want the client to be able to change it using the control.  On null values when I click "edit" I receive an  "Invalid cast" error.  This is because there are null values in the db.  Also, when I try to edit a field that has data, I click on a calendar date and then "Update" and I get nothing??  I went so far as to declare a protected method in my code behind to determine if the date was...

Editable GridView: Need C# code for Editable Gridview web part..!!
  I have created a Sharepoint Web Part programmatically in C# which fetches data from SQL database and displays in a Gridview. Its working fine. Now i need to make this gridview editable so that the changes should be reflected / saved back into SQL Database. I am running oout of time and need help immediately. Can somebody help me in getting the code for Editable Gridview please........???? Thank you Can Sombody help me out here.......... there are so many examples on the web

Web resources about - how to disable editing for some of the value in the gridview when edit function is clicked -

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012 - Upcoming stories is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 2/24/2016 12:16:40 PM