473,320 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Grid View, programmatically set gridview textbox property readonly=false

Hi

Someone please help me


string typ;
if (e.Row.RowType == DataControlRowType.DataRow)
{
typ = e.Row.Cells[4].Text;




I got this line in onRowDataBound


I have a problem, WHEN I SET THIS boundfield -> column 4, as Visible =true (to display in gridview), i can get th value by above code line.

If i set visible =false (which I don't want display in gridview), i cant get the value.
May 5 '07 #1
2 11001
Hi,


Currently i have a GridView with 1 text box template column, on start, i will set this textbox readonly =true

When user click edit button, i would like to set the textbox control readonly=false so user can type in new text,

i put it in gridview1_onDataBound()

as follow

if (e.Row.RowState == DataControlRowState.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row.FindControl("txtbox1");
msgtxtBox1.ReadOnly = false;
}


well, it is work,

when i click edit in first row of the grid, the textbox readonly set to false, i can type in new text.

BUT it is very weird, because ONLY ODD NUMBER grid row can work,

when i click on second row edit button, the textbox readonly still true,

when i click on third, it is work, then when i click on 5th row, it work too..


someone can help?
May 6 '07 #2
gomzi
304 100+
Hi,


Currently i have a GridView with 1 text box template column, on start, i will set this textbox readonly =true

When user click edit button, i would like to set the textbox control readonly=false so user can type in new text,

i put it in gridview1_onDataBound()

as follow

if (e.Row.RowState == DataControlRowState.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row.FindControl("txtbox1");
msgtxtBox1.ReadOnly = false;
}


well, it is work,

when i click edit in first row of the grid, the textbox readonly set to false, i can type in new text.

BUT it is very weird, because ONLY ODD NUMBER grid row can work,

when i click on second row edit button, the textbox readonly still true,

when i click on third, it is work, then when i click on 5th row, it work too..


someone can help?
try peforming the operations in rowcommand of the gridview.
not sure as to why odd number ones work!!!
May 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gill Smith | last post by:
After setting the web control text box enable property to FALSE makes the control to loose the data between round trip. I am making sure that the property - EnableViewState = TRUE. Same code...
0
by: weiwei | last post by:
Hi; I am having trouble to get variable from grid view. here is my scenario. I want to delete a row in database from web page, in additon, I also want to delete that user's directory in c:drive. ...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
2
by: Wayne Deleer | last post by:
Hi All, I'm currently working on a project, and I've come to a part where I want to add data to a GridView. BUT, I want to do it programmatically, with alot of control over everything. In my...
3
by: Andrew Robinson | last post by:
I have a Grid View and associated Object Data Source control. The ODS interface with a custom data source that returns a List<MyEntity>. I am only referencing some of the columns on the GridView....
12
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that...
1
by: =?Utf-8?B?Ym9iYnk=?= | last post by:
Hi All, I have a Gridview in my asp page. In first bound column I have Id field. I want this column to be invisible in Gridview but when I selecyt the row i should be able to get the value of...
4
by: kavithadv | last post by:
hi Please help me i want to fix a column in grid view i used style for locking the column since i am setting the position as relative its not working properly i have given my code below ...
0
by: baijuraj | last post by:
I added an Ajax Rating Control in a GridView using the code <asp:TemplateField HeaderText="Rating"> <ItemTemplate> ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.