473,387 Members | 1,892 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,387 software developers and data experts.

Datagrid Cells: Getting the value

We have a datagrid built using template columns. Many are
text boxes. These text boxes are bound to a datasource as
follows: <ItemTemplate>
<asp:TextBox
id="txtPeriod1"
runat="server"
columns="1"
Font-Size="8pt"
text='<%# Container.dataitem
("LaborHoursAm")%>' >
</asp:TextBox>
</ItemTemplate>

My problem arises when I change the data (like changing
txtPeriod1 from 80 to 30) in the column and try to
retrieve it. When I spin through the datagrid values I see
the "80", the bound value, not the "30" the value I want
to change it too. Is there a way I can accomplish this?
Nov 18 '05 #1
3 1625
If you are using a DataSet - - you need to first, update the dataset before
you 'spin through' the datagrid (I assume you mean Dataset - - otherwise - -
show us how you're doing it)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"ALPO" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
We have a datagrid built using template columns. Many are
text boxes. These text boxes are bound to a datasource as
follows: <ItemTemplate>
<asp:TextBox
id="txtPeriod1"
runat="server"
columns="1"
Font-Size="8pt"
text='<%# Container.dataitem
("LaborHoursAm")%>' >
</asp:TextBox>
</ItemTemplate>

My problem arises when I change the data (like changing
txtPeriod1 from 80 to 30) in the column and try to
retrieve it. When I spin through the datagrid values I see
the "80", the bound value, not the "30" the value I want
to change it too. Is there a way I can accomplish this?

Nov 18 '05 #2
Yes it is a dataset. However, how can i update the
dataset with the new value? The tricky part is we are
trying to avoid the single row edits so we don't have
an "editcommandbutton". Our thought was to spin through
the items in the datagrid page, update the dataset, then
bind the grid again. Here is what i am trying to do in
the code behind.

For iItemCount = 0 To LaborGrid.Items.Count - 1
LaborGrid.SelectedIndex = iItemCount
Debug.Write(LaborGrid.SelectedIndex & vbCrLf)
With LaborGrid.SelectedItem
Debug.Write("selecteditem :" &
LaborGrid.SelectedItem.Cells(8).Text & vbCrLf)
txtbox = LaborGrid.SelectedItem.FindControl
("txtPeriod1")
'value = txtbox.Text
'Debug.Write("value :" & value & vbCrLf)
End With
Next

I get my selecteditem number ok, but I can't get the new
number. I am missing something here, something that
the "editcommandbutton" would do. We are using a non-grid
button because the user wants to be able to update any
column of any row before updating. Is it possible?
-----Original Message-----
If you are using a DataSet - - you need to first, update the dataset beforeyou 'spin through' the datagrid (I assume you mean Dataset - - otherwise - -show us how you're doing it)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"ALPO" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
We have a datagrid built using template columns. Many are text boxes. These text boxes are bound to a datasource as follows: <ItemTemplate>
<asp:TextBox
id="txtPeriod1"
runat="server"
columns="1"
Font-Size="8pt"
text='<%# Container.dataitem
("LaborHoursAm")%>' >
</asp:TextBox>
</ItemTemplate>

My problem arises when I change the data (like changing
txtPeriod1 from 80 to 30) in the column and try to
retrieve it. When I spin through the datagrid values I see the "80", the bound value, not the "30" the value I want
to change it too. Is there a way I can accomplish this?

.

Nov 18 '05 #3
This is basically what i want to do......

1) The user changes values for a few columns in different
rows
2)The user clicks a "recalc" button
3)The new values of the cells in are updated into the
cached dataset
4)Perform a DataBind

Sorry if I am confusing you, I've just been trying to skin
this cat for a couple of days, and I am furstrated and
beginning to think it can't be done.
-----Original Message-----
If you are using a DataSet - - you need to first, update the dataset beforeyou 'spin through' the datagrid (I assume you mean Dataset - - otherwise - -show us how you're doing it)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"ALPO" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
We have a datagrid built using template columns. Many are text boxes. These text boxes are bound to a datasource as follows: <ItemTemplate>
<asp:TextBox
id="txtPeriod1"
runat="server"
columns="1"
Font-Size="8pt"
text='<%# Container.dataitem
("LaborHoursAm")%>' >
</asp:TextBox>
</ItemTemplate>

My problem arises when I change the data (like changing
txtPeriod1 from 80 to 30) in the column and try to
retrieve it. When I spin through the datagrid values I see the "80", the bound value, not the "30" the value I want
to change it too. Is there a way I can accomplish this?

.

Nov 18 '05 #4

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

Similar topics

4
by: kscdavefl | last post by:
I ahve a datagrid on a web form. I need to change the value in column 3 as follows. If the value in column 3 reads 0, I want to change it to read YES. How can I accomplish this task. ...
2
by: Joe Au | last post by:
I follow the Walkthrough documented on Visual Studio to create an editable data grid but it does not work on getting the value of the textbox in the data grid. The code is copied here. I mark...
5
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
2
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
5
by: Antonio | last post by:
Hello, everyone. Is there a way to not display a certain value in a datagrid cell? I have a datagrid for subscriptions and ebooks and if there isn't an e-book listed, the value from the...
1
by: sp | last post by:
Hello I have a problem with the refresh performance in datagrid – when datagrid is being shown it is so slow that I can see one by one cells is drawn -datagrid contains about 35x40 of...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: rn5a | last post by:
Suppose I have the following DataGrid: <asp:DataGrid ID="dgUsers" OnUpdateCommand="UpdateDG" runat="server"> <Columns> <TemplateColumn HeaderText="NAME"> <ItemTemplate> <asp:Label...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.