PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Populating a datagrid dynamically, creating Session Variabbles
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
Populating a datagrid dynamically, creating Session Variabbles
![]() |
Populating a datagrid dynamically, creating Session Variabbles |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi all :-) I have a couple of web pages created using ASP.Net and VB code-behind. We use a connection call through an RPC to COBOL, NOT an SQL connection, so my connection to get the data is done in a Class Module (VB), which populates the datagrid. The datagrid is bound in the code-behind the ASPX page, as such
dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet dtg_worksheet1.DataBind( The code to populate my datagrid from the class module (inpart) is 'Create the column headers dt_worksheet1.Columns.Add(New DataColumn("County") dt_worksheet1.Columns.Add(New DataColumn("Gasoline Gallons") dt_worksheet1.Columns.Add(New DataColumn("Gasohol Gallons") dt_worksheet1.Columns.Add(New DataColumn("Total Gallons") 'Build the DataTable with the Data For i = 0 To li_rpd_array_row_len - 1 Step i + Tr ' row number and withdrawal type ls_temp = ao_buffer.ExtractString(CType(li_start_arr, Short), CType(li_arr_str_len, Short) dr_gallons = dt_worksheet1.NewRow( ls_temp_arr = ls_temp.Substring(li_county_name, li_county_name_len).Trim( ls_county = ls_temp_arr.ToString().Tri dr_gallons(0) = ls_count ls_temp_arr = ls_temp.Substring(li_tot_gas_glln, li_tot_gas_glln_len).Trim( ls_tot_gas = ls_temp_arr.ToString().Trim( dr_gallons(1) = CInt(ls_tot_gas ls_temp_arr = ls_temp.Substring(li_tot_gasohol_glln, li_tot_gasohol_glln_len).Trim( ls_tot_gasohol = ls_temp_arr.ToString().Tri dr_gallons(2) = CInt(ls_tot_gasohol ls_tot_gallons = CDbl(ls_tot_gasohol) + CDbl(ls_tot_gas dr_gallons(3) = CDbl(ls_tot_gallons I need to know how to get a specific row/cell of data to post as a session variable - like I would with an ASP.Net table: Dim ld_sum_tot_cty_tax As Doubl Session("wa_tot_gal") = tbl_worksheet1.Rows(16).Cells(3).Text( How can I do this programmatically with the datagrid? Any help is GREATLY appreciated! Coleen --- Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/ |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Coleen,
The session variable in aspx acts the same as in classic asp pages. I have not seen any differences till now. But another posibility is the "viewstate", have a look for that on MSDN I think that is better for the solution you are looking for. Maybe for you intresting is that tomorrow is this chat that I wrote beneath I hope this helps? Cor --------------------------------------------------------------------------- Do you have questions about how to create great ASP.NET applications with Visual Basic .NET? Join members of the Visual Basic and Web Forms teams for a discussion about getting the most out of your Web applications. Get answers from the experts to your questions about Visual Basic and ASP.NET. Date: February 3, 2004 Time: 1:00 - 2:00 P.M. Pacific time 4:00 - 5:00 P.M. Eastern time 21:00 - 22:00 BST/BST (For a list of local time zones relative to GMT, please see http://msdn.microsoft.com/chats/timezones.asp.) Outlook Reminder: http://msdn.microsoft.com/chats/out...rs/VS_Feb03.vcs Location: http://msdn.microsoft.com/chats (then click the name of the chat to enter the chat room) For more information about Visual Basic .NET, see http://msdn.microsoft.com/vbasic/ To see a list of upcoming chats or set a reminder for this chat, see http://msdn.microsoft.com/chats. For archives of previous chats, see http://msdn.microsoft.com/chats/recent.asp. Thanks! Jason Cooke VB.NET Team ======== This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. (c) 2004 Microsoft Corporation. All rights reserved. ------------------------------------------------- |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Honestly, I'm not looking for how to get the Session variable, I know how to do that, I'm trying to get a specific row/cell of data from the dynamically populated datagrid (to use as my session variable), and so far, not having much luck...thanks for your help :-)
--- Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/ |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Hi Coleen,
The problem is I do not see that tbl_workstheet1 when it is just a typo and had to be dt_worksheet1 than I think it can be something as Session("wa_tot_gal") = dt_worksheet1.Rows(16)(3).tostring or complete dt_workstheet1.Rows(16).item(3).tostring I am curious if it was that? Cor |
|
|
|
#5 |
|
Guest
Posts: n/a
|
No, I used the example of getting the specific row/column form an ASP table...I need to know how to get a specific row/column from a dynamically populated datagrid...
I have been trying everything I can think of to get the specific row(18).cell(7) from my datagrid. This works perfectly in an ASP table but NOT in a datagrid! I checked the Help files and can return a specific column, but I can't get to the specific ROW - I keep getting an error that the row is out of bounds. Or, I get an error (blue squigleys) that Row is not a part of Items or of Columns properties...ARGH! I just want a specific Row(18).Cell(7) from my datagrid - please how do I get this info from a datagrid? Thanks for your help :-) Coleen --- Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/ |
|
|
|
#6 |
|
Guest
Posts: n/a
|
Hi Colleen,
But why not just from your underlaying datatable, you have it. (I did a while nothing with a aspx datagrid and that should I investigate). Cor |
|
|
|
#7 |
|
Guest
Posts: n/a
|
I can't get the SPECIFIC row - it is imperitive that I get the value from specifically row 16, cell 7. This is simple in the ASPX table, but I can not get it from the datagrid. I can return a specific column, but Ican't seem to get it to give me the value for the exact row I need...any suggestions?
--- Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/ |
|
|
|
#8 |
|
Guest
Posts: n/a
|
Hi Coleen,
Can you try this? When clicked Dim a As String = grd.Items(e.Item.ItemIndex).Cells(3).Text or as you ask Dim a as string = grd.Items(15).Cells(6).Text I hope this helps? Cor < > I can't get the SPECIFIC row - it is imperitive that I get the value from specifically row 16, cell 7. This is simple in the ASPX table, but I can not get it from the datagrid. I can return a specific column, but Ican't seem to get it to give me the value for the exact row I need...any suggestions? > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

