473,756 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cannot change value of texbox w/in datagrid after first bind

I have a datagrid with the columns defined in the aspx
<columns>
<asp:TemplateCo lumn HeaderText="Hou rs" ItemStyle-Width="1%"ItemS tyle-HorizontalAlign ="Center">
<ItemTemplate >
<asp:TextBox Columns="2" EnableViewState ="False" ID="Hours"Runat ="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateCol umn>
...
</columns>

I have other bound columns that display the correct data so Iknow the dataset is ok.
Here's the problem. In
dgTest_ItemBoun d(...) Handles dgTest.ItemData Bound
I have:
CType(e.Item.Ce lls(3).FindCont rol("Hours"), TextBox).Text =drv("TotalHour s").ToString

When I make the first request, the hours txtbox is populatedcorrec tly. Any rebinding after that, the value is unchanged. Ifthe box initially was filled with '20' and the grid was reboundto contain 0 hours, 20 remains, even though another bound columncontainin g 'TotalHours' DOES change. This is very strange. Anyideas?

I've already tried things with viewstate on/off for the dg andtxtbox. I've already tried adding the textbox controldynamica lly and clearing it, etc. No good.

I also tried using <asp:textbox><% # eval....contain er...%></asp:textbox> but you can't do that for other reasons.

Any help if appreciated. Thank you.
--------------------------------
From: Michael Haren

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>/SNv1WoZ0kqnEWLy QtolIQ==</Id>
Nov 21 '05 #1
1 1628
Hi,

Sounds like you are filling the dataset even when you are posting back.

Ken

--------------------------
"Michael via .NET 247" <an*******@dotn et247.com> wrote in message
news:uM******** ******@TK2MSFTN GP12.phx.gbl...
I have a datagrid with the columns defined in the aspx
<columns>
<asp:TemplateCo lumn HeaderText="Hou rs" ItemStyle-Width="1%"
ItemStyle-HorizontalAlign ="Center">
<ItemTemplate >
<asp:TextBox Columns="2" EnableViewState ="False" ID="Hours"
Runat="server"> </asp:TextBox>
</ItemTemplate>
</asp:TemplateCol umn>
...
</columns>

I have other bound columns that display the correct data so I know the
dataset is ok.
Here's the problem. In
dgTest_ItemBoun d(...) Handles dgTest.ItemData Bound
I have:
CType(e.Item.Ce lls(3).FindCont rol("Hours"), TextBox).Text =
drv("TotalHours ").ToString

When I make the first request, the hours txtbox is populated correctly. Any
rebinding after that, the value is unchanged. If the box initially was
filled with '20' and the grid was rebound to contain 0 hours, 20 remains,
even though another bound column containing 'TotalHours' DOES change. This
is very strange. Any ideas?

I've already tried things with viewstate on/off for the dg and txtbox. I've
already tried adding the textbox control dynamically and clearing it, etc.
No good.

I also tried using <asp:textbox><% # eval....contain er... %></asp:textbox>
but you can't do that for other reasons.

Any help if appreciated. Thank you.
--------------------------------
From: Michael Haren

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>/SNv1WoZ0kqnEWLy QtolIQ==</Id>
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3337
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this? Also, If the user change the text in the textbox then how do I refesh the display in the datagrid to reflect the changes? ...
2
2113
by: | last post by:
Hello All, I am having a lot of difficulty trying to bind a templated column, that is programmatically created for a datagrid, to a datasource column. I have a datasource containing 2 columns, ID and VALUE. I would like to create a templated column in the datagrid that is bound to the VALUE column of the datasource.
0
473
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass = "SectionTableLines"; dgG.DataKeyField = "PlanWorkOrderID";
3
10928
by: Joel Daniels | last post by:
Hello, I am trying to determine the proper way to access the underlying data row for a Repeater item in the ItemCommand event. In the page load event, I bind the Repeater data source to a SqlDataReader. I check for !IsPostBack so the data binding only happens the first time. In the ItemCommand event, e.Item.DataItem is unassigned. Any suggestions? Thanks!
0
1440
by: keys4worship | last post by:
I have a datagrid that contains among other things an SSN and a button. I have added an onclick attribute to the button that works with vbscript to query information on 3270 Pcomm emulator. The vbscript uses something like document.form.txtSsn.Value to grab the SSN. When the button on the datagrid is clicked the SSN is placed in the hidden texbox for use with the vbscript. My problem is that the button is used to place the SSN in the...
1
4236
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get the example to work. I created the following two classes, provided with the example: *-*-**-*-*-*-*-*-*-*-*-*-**-*-*-*-*-CheckBoxColumn Class:-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-**-*-*-*
1
2948
by: Doug D via .NET 247 | last post by:
I really really need some insight on this problem I am trying to bind a strongly typed collection object to a datagrid. I already Inherited CollectionBase, but .NET says that it cannot find my property name, when I try to bind it to the grid.. now, here is where it gets tricky. Do I NEED to Implement IBindingList, on my collection object, since my object that I am adding to the collection inherits from a another class? here is my...
17
2769
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
6
9197
by: Marc Robitaille | last post by:
Hello, Hello, I developed a UserControl. It has funny behavior. It is composed of three controls. A texbox, a combobox and a button. There are three properties to indicate the visibility of the three controls. The only property which functions well is the one for the button. The two others, even if I do: UserControl.TextboxVisible = True or UserControl.ComboboxVisible = True, the textbox or the combobox remain invisible. I placed a...
1
9819
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
9689
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
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6514
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
5119
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
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
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
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2647
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.