Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Populate Session Variables from Datagrid for a specific cell

Reply
Thread Tools

Populate Session Variables from Datagrid for a specific cell

 
 
coleenholley
Guest
Posts: n/a
 
      02-02-2004
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(

I am using VB.Net as the code behind, and populating the datagrid dynamically in a VB.Net Class Module - I am NOT connecting to an SQL database, but I do use the databind function

dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet
dtg_worksheet1.DataBind(

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/
 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      02-03-2004
Every row of data which is bound to the grid fires the itemdatabound event.
So in its handler, you can take the appropriate action. Consider
Session["row"] = e.item.cells[0].text will store the first colum of the row
being bou nd

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
<coleenholley> wrote in message
news:%(E-Mail Removed)...
> 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 Double
> Session("wa_tot_gal") = tbl_worksheet1.Rows(16).Cells(3).Text()
>
> I am using VB.Net as the code behind, and populating the datagrid

dynamically in a VB.Net Class Module - I am NOT connecting to an SQL
database, but I do use the databind function:
>
> dtg_worksheet1.DataSource = lo_AZRM005A.get_dt_worksheet1
> dtg_worksheet1.DataBind()
>
> 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/


 
Reply With Quote
 
 
 
 
coleenholley
Guest
Posts: n/a
 
      02-03-2004
Thanks - that helps, but I need to get the value from a Specific row - the data returned will ALWAYS have 17 rows - it will return one row for each County in Nevada, and there are 17 Counties. I specifically need to get the value from row (county) 16 for a session variable. Using Session["row"] = e.item.cells[7].text will store the seventh colum of the which row? How do I tell it to specifically get row 16? I REALLY need to have the functionality of Row(16).Cell(7); it is imperitive to the application we are building...any suggestions on getting the exact row number? Thanks for your help. Coleen

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
 
Reply With Quote
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      02-03-2004
off the top of my head, if i didn't have the dataset already cached, i'd
collect each row and stack it into an array list. Then push that array list
into session.

Remind me again why you need to have this in a session variable (i've lost
the original thread)? It would seem to me that if you cache the entire
dataset, or datatable, then you could easily retrieve the dataset and access
the value directly. Consider:

DataSet ds = Session["Data"] as DataSet;
if(ds != null && ds.Tables[0].Rows.Count > 16)
value = ds.Tables[0].Rows[16][7].ToString();

Ofcourse, it is more memory efficient to cache a datatable or to stack just
the rows in an arraylist.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
<coleenholley> wrote in message
news:(E-Mail Removed)...
> Thanks - that helps, but I need to get the value from a Specific row - the

data returned will ALWAYS have 17 rows - it will return one row for each
County in Nevada, and there are 17 Counties. I specifically need to get the
value from row (county) 16 for a session variable. Using Session["row"] =
e.item.cells[7].text will store the seventh colum of the which row? How do
I tell it to specifically get row 16? I REALLY need to have the
functionality of Row(16).Cell(7); it is imperitive to the application we are
building...any suggestions on getting the exact row number? Thanks for your
help. Coleen
>
> ---
> Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate the textbox in cell of a datagrid Vivek Sharma ASP .Net Web Controls 0 11-21-2005 03:47 AM
Populate a popup window with clickable records from an Access DB and upon clicking, populate a selectbox on the original webpage with the clicked record Enjoy Life ASP General 2 02-23-2005 10:48 PM
Re: fire event when click on specific cell in dataGrid using asp.net Eliyahu Goldin ASP .Net 1 07-31-2004 12:11 PM
Re: fire event when click on specific cell in dataGrid using asp.net Cory D. ASP .Net 1 07-28-2004 10:27 AM
Re: fire event when click on specific cell in dataGrid using asp.net John Saunders ASP .Net 0 07-27-2004 09:31 PM



Advertisments