PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Can you persist table cell values like you do with form field values?

 
 
Richard Dixson
Guest
Posts: n/a
 
      18th May 2004
Under ASP.NET (C#) I want to create a page that people can use to submit
questions. This page will consist of a table with several rows of
information, like:
Name: Bill Smith
Job title: Developer
Address: 123 Main Street.

After the table of information will be the web form. So basically I want to
display the table and then have the web form.

At the time the page is first displayed (before the form is submitted - the
GET request) I want to dynamically set all the values in my table as shown
above (Bill Smith, Developer, etc) based on a db lookup. That I know how to
do. But once the web form is submitted (the POST request/postback) I want
to be able to read in those values from the table cells that I set during
the GET - without having to look them up from the db again. I could store
all the values into session variables or make them into hidden form field
values that get posted back in, but that seems messy.

Is it possible to set things up so that when the page is posted back the
table cell values I set previously (Bill Smith, Develooper, 123 Main Street)
persist automatically through the power of ASP.NET - or do I have to get
fancy and persist them on my own so that I have the values during the POST
without having to look them back up? Either way, any tips on the easiest,
most straight-forward way to do this is greatly appreciated.

Thank you.




 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      18th May 2004
Hi,

The default behavior of Grid is to preserve it data using viewstate. On
postback ASP.NET use viewstate data do rebuild your grid containing
previous round data. Grids are actually tables that you can access via
grid controls collection. You can use DataGridTable to access any rows
and columns :
string s = DataGrid1.Controls[0].Rows[1].Cells[0].Text;

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Richard Dixson
Guest
Posts: n/a
 
      18th May 2004
As it turns out the information needed for my table I want to persist is not
going to come from a database afterall. Instead it will come from values
returned by a class library.

With that in mind, can anyone point me to a sample that demonstrates how to
populate a DataGrid control using data that comes from memory instead of a
db? I assume this is possible? In other words say I want my table to look
like this:

Value 1: val2
Value 2: val2
Value 3: val3
Value 5: val4
Value 5: val5

And I have these values ("val1" - "val5") in a string array. How do I
create a datagrid and populate it using this array's values instead of a db
value? Do I have to create an in memory dataset using other routines and
give the grid this data set, and if so, how is this done? Or can I set
these values directly? Any examples would be greatly appreciated.

Thanks.

"Natty Gur" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
>
> The default behavior of Grid is to preserve it data using viewstate. On
> postback ASP.NET use viewstate data do rebuild your grid containing
> previous round data. Grids are actually tables that you can access via
> grid controls collection. You can use DataGridTable to access any rows
> and columns :
> string s = DataGrid1.Controls[0].Rows[1].Cells[0].Text;
>
> Natty Gur[MVP]
>
> blog : http://weblogs.asp.net/ngur
> Mobile: +972-(0)58-888377
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Autofill field on form with values from another table amiliab Microsoft Access Forms 0 25th Mar 2010 08:39 PM
match 2 values in a field to values listed in a table Rob Microsoft Access Reports 4 27th Jan 2009 02:17 PM
Outlook 2003 Custom form field values do not persist after publish Pasqual Microsoft Outlook Form Programming 1 13th May 2008 03:15 AM
Table fields:- Setting default values to be based on other field values Rob W Microsoft Access 3 20th Feb 2008 08:51 PM
Can you persist table cell values like you can do with form field values? Richard Dixson Microsoft ASP .NET 1 18th May 2004 04:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 PM.