Separate edit page for a Data Grid

E

Evan M.

Hello there,

I have a data grid that's going to display a but of data that I want to
make editable. Problem with this is that there goign to be too many
columns, and the data grid is going to be too wide to be practical, so
I think the best bet is just to make the editing done on a separate
page.

However, I'm hitting a problem with trying to figure out how to get
this going. I'm trying to keep this programatically simple so that it's
as easy to maintain by those unfamiliar with the code as possible, but
solutions I start to play with in my head seem overly complex. Any help
/ suggestions on a direction to go would be greatly appreciated.

Thanks
Evan M.
 
E

Elton Wang

Hi Evan,

You can have a ButtonColumn, e.g. CommandName = "Edit", in the datagrid. And
in datagrid_ItemCommand event (triggerd by click Edit button) to save
clicked DataGridItem (e.Item) to Session and open Edit page. In Edit page
retrieve data from Session to get edit DataGridItem. Then perform your
editing task in the page.

HTH

Elton Wang
 
F

Fiaz Ali Saleemi

Hi Evan

Solution suggested by Elton is the best way to do it, I would also like to
suggest the same solution but instead of storing data into the session use
context and then Transfere the request to the edit page and in edit page
retrieve values from context.

Context["EditItem"] = e.Item;
Server.Transfer("Edit.aspx");

//In edit page
DataGridItem dgItem = (DataGridItem)Context["EditItem"];
Populate(dgItem);

Regards
Fiaz Ali Saleemi
 
E

Evan M.

Thanks guys for the suggestion. Will try implementing it today.

Fiaz, when I try and access the Context class as you suggested, VS.NET
complains to me, saying "Cannot apply indexing with [] to an expression
of type 'System.Web.HttpContext'". Did you mean to use the
Context.Cache collection instead?

In either case, I think I'll stick with using the Session collection
instead. This application runs on a local company intranet, so traffic
limitations are negligable. As well, using session should help me avoid
some of the multi-access issues that I've run across trying to cache my
dataset with multiple users.

Thanks Again
Evan M.
 
F

Fiaz Ali Saleemi

Hi Evan

I have written wrong code by mistake. Actually that is Context.Items
collection.

Regards
Fiaz Ali Saleemi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top