473,837 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grid View, programmaticall y set gridview textbox property readonly=false

74 New Member
Hi

Someone please help me


string typ;
if (e.Row.RowType == DataControlRowT ype.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 11078
johnlim20088
74 New Member
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_onDat aBound()

as follow

if (e.Row.RowState == DataControlRowS tate.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row. FindControl("tx tbox1");
msgtxtBox1.Read Only = 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 Contributor
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_onDat aBound()

as follow

if (e.Row.RowState == DataControlRowS tate.Edit)
{

TextBox msgtxtBox1 = (TextBox)e.Row. FindControl("tx tbox1");
msgtxtBox1.Read Only = 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
3589
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 when the text box Enable property set to TRUE retains the value. Please advice. -Gill
0
2400
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. so far, I can only finished the first part which is to delete the row from database, Please see below code where I want to get variable in order to delete the directory. Thanks in advance <%@ Page Language="VB" Debug="true" %> <script...
0
4172
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 "inizialize" the Data Grid View (add a data sorce, filled with notthing at staratup, and hide some columns) when i put a code in the txtCLCOD textbox start a searsh. If i foud something i popolate the Data grid view on the second page. Now the magic if i...
2
6739
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 particular project I've passed a DataSet to a page via a Session object. The Session object passes without incident, and I can use the default settings to retrieve the information without problem and plug all the information into the GridView.
3
1926
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. When editing a row within the Grid View, the columns that are not referenced, are being set to null. Is this by design or am I missing something else somewhere?
12
4730
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 variable in the url. I would like that variable to trigger a stored and
1
2381
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 that cell. I set the Column property Visible = False. and in my code behind page GridViewRow grow = gdProxy.Rows; int proxyId = Convert.ToInt32(grow.Cells.Text); But it doesn't work but if I set Visible + true It works. But I don't want
4
1846
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 could any body fix this issue <style type="text/css"> /* Div container to wrap the datagrid */ div#div-datagrid { width: 700px;
0
1096
by: baijuraj | last post by:
I added an Ajax Rating Control in a GridView using the code <asp:TemplateField HeaderText="Rating"> <ItemTemplate> <ajaxToolkit:Rating ID="Rating2" runat="server" EmptyStarCssClass="emptyRatingStar" FilledStarCssClass="filledRatingStar" OnChanged="Rating2_Changed" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" Width="128px"...
0
9843
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9683
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7811
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5670
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5851
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.