473,804 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't retrieve updated fields from Datagrid

I'm new to ASP.NET and I'm trying to create an aspx page that retrieves info
from a database, let's the user make a change and write the change back. It
reads from the database just fine. The problem lies when you try to edit a
field. The change doesn't get passed back to the vb code. Here are code
fragments of what I'm trying to do:

Here is a part of the HTML dealing with one field...

<asp:TemplateCo lumn HeaderText="Reg Clerk">
<ItemStyle Wrap="False" HorizontalAlign ="Center"></ItemStyle>
<ItemTemplate >
<asp:Label Runat=server text='<%# Container.DataI tem("RegClerk") %>'
id="Label75">
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox Enabled=True Width=50 CssClass="text" Runat="server"
ID="txtRegClerk " Text='<%# Container.DataI tem("RegClerk") %>' Wrap="false">
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

Here is the vb code that tries to retrieve the edited value in "RegClerk":

Dim RegClerk As String =
CType(Me.DataGr id1.Items(e.Ite m.ItemIndex).Fi ndControl("txtR egClerk"),
TextBox).Text

If there's already a value in the field, the original value comes through
OK. If you edit it, only the original value seems to be passed.

What am I missing?

Thanks,
Mark


Nov 22 '05 #1
0 1095

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

Similar topics

1
5282
by: Bob Kaku | last post by:
I'm trying to retrieve a text value from a MySQL database, put it into an updateable form, allow edits, and send back the edited text back into the MySQL database. I've been able to successfully retrieve the text and put it into the editable form, using htmlspecialchars function. But, I can't find a way of accepting the edited text and sending back to the database. Here's my code for retrieval. <?php
0
285
by: Mark Brown | last post by:
I'm new to ASP.NET and I'm trying to create an aspx page that retrieves info from a database, let's the user make a change and write the change back. It reads from the database just fine. The problem lies when you try to edit a field. The change doesn't get passed back to the vb code. Here are code fragments of what I'm trying to do: Here is a part of the HTML dealing with one field... <asp:TemplateColumn HeaderText="Reg Clerk">...
1
996
by: Jason Shohet | last post by:
We have some db-search functionality that we need in several asp.net apps. How to get reuse out of this... I was thinking of putting the search criteria, and the datagrid that displays the results, in an ascx control that can be plopped down in any of our apps. 1. I'm just not sure about putting a datagrid in an ascx -- any minuses to doing this? 2. Can an ascx can call a web service (thats where we put our ADO stuff --
1
6515
by: Linda | last post by:
Hi, I'm new to asp.net and tryign to learn how to work with data grids. I'm retrieving data from a stored procedure and putting it in a data grid. I then want to be able to sort the data when clicking on the headers, using the Sub grdList_SortCommand. When clicking a header I get the error message: "System.Data.DataException: DataTable must be set prior to using DataView."
1
1678
by: headbig003 | last post by:
Hello I put template column in datagrid. Below is the html code I used. <asp:datagrid id="dgAnswer" runat="server" Width="360px" AutoGenerateColumns="False" DataKeyField="ansID"> <Columns> <asp:TemplateColumn HeaderText="Answer Text"> <ItemTemplate> <asp:TextBox id="txtItem" runat="server" Width="201px" Text='<%#
3
1335
by: MaryA | last post by:
I have an asp.net application in which i have a form containing a datagrid when using the update command event i have: tb = CType(e.Item.Cells(3).Controls(0), TextBox) subject = tb.Text this code is supposed to get the new data entered in the text box but i am getting the old data why?
0
1239
by: Tuomo | last post by:
Hi! I have a form (System.Web.UI.Page) that contains a DataGrid control and a DataTable that contains values for the data grid and that is data bound to the DataGrid. When I switch the grid to edit mode (e.g. if I set DataGrid.EditItemIndex = 0) the values in the data table are displayed correctly in TextBox controls in the DataGrid at the first time. Then, if I cause a postback (e.g. by pressing a button) and I set a new value into a...
1
2036
by: .net_developer | last post by:
Hi I have a datagrid that has the following fields.. 1.Document Title - Bound Column 2.Document Date-Bound Column 3.Save to Computer- Template Column-Link Button I need to retrieve the document title when the corresponding linkbutton is clicked.
8
3278
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've searched high and low through help databases and on the internet. The directions say to : Open the table in Design view Click the Data Type column of the field you want to change, click the
1
3691
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
9708
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
9587
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
10588
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
10085
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
9161
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
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.