DataGrid, Seperate template for InsertItem

W

Weston Weems

Hello...

I've used datagrid extensively and know its strenths and
weakness's rather well.

My question is this... I've got the requirement to insert
a template row at a given index, which theoretically
wouldnt be a problem, however I need a slightly diff
template than my edititemtemplate.

Can I create a template of my own and some how specify I
want to start editing item with index of {X}?

Thank you guys in advance.
 
S

Scott Mitchell [MVP]

My question is this... I've got the requirement to insert
a template row at a given index, which theoretically
wouldnt be a problem, however I need a slightly diff
template than my edititemtemplate.

Can I create a template of my own and some how specify I
want to start editing item with index of {X}?

I guess I'm not understanding your question 100% - you have a DataGrid
that needs to have an editable row, no? How is the EditItemTemplate
failing to provide you the customization you need?

Thanks.

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
W

Weston Weems

I am attempting to get the datagrid to allow me to insert
a new row (ultimately inserting into the database etc..)
I've got the edittemplate for updating rows just fine...

But in inserting a NEW row, theres additional data
requried (even though its not shown in edit or just
regular viewing.

I guess I may need to subclass datagrid, maybe not.
 
S

Scott Mitchell [MVP]

Weston said:
I am attempting to get the datagrid to allow me to insert
a new row (ultimately inserting into the database etc..)
I've got the edittemplate for updating rows just fine...

But in inserting a NEW row, theres additional data
requried (even though its not shown in edit or just
regular viewing.

Why not use the footer of the DataGrid? There are a myriad of articles
online that talk about this approach, such as this one:
http://aspnet.4guysfromrolla.com/articles/021203-1.aspx

See a screenshot of it in action at:
http://aspnet.4guysfromrolla.com/images/pubsGrid.jpg

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
J

JDP@Work

I had a similar problem, I enclosed my datagrid in a panel, I then created an
identical panel and put the appropriate fields.

In my case depending on the security role users can see different options, for
example if they are a power user they do not see an option for security role or
market center, only lables with those values, (they can only create standard
users and only for their market center).

I then put both a Details link in the datagrid and a New button below. When the
Details link or New button are selected they see the other panel and can edit
all the appropriate fields including the additional required fields not
displayed in the datagrid.. Since the two panels are the same size there is
little screen flicker.

Setting the visible to T/F appropriately. I also use viewstate = false to clear
the fields when doing a New, and ItemCommand for editing.

HTH

JeffP.....
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top