473,812 Members | 2,821 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 11075
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
3588
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
2399
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
4169
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
6738
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
1925
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
4729
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
2380
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
1845
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
9607
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,...
0
10664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10139
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...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
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
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4357
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3029
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.