472,328 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 1557
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...
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...
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...
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,...
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...
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...
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...
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...
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...
0
by: rn5a | last post by:
Suppose I have the following DataGrid: <asp:DataGrid ID="dgUsers" OnUpdateCommand="UpdateDG" runat="server"> <Columns> <TemplateColumn...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.