Home All Groups Group Topic Archive Search About
Author
16 Mar 2006 9:11 PM
David Thielen
Hi;

I have two pages, one for creating a record which is just a bunch of
controls and one for editing a record which is a FormView. The two pages have
all the same controls and look the same.

Is there any way to use the FormView for creating a record? It appears that
it assumes a record already exists which would not allow this but I figure
better to ask than assume.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Author
17 Mar 2006 3:07 AM
Steven Cheng[MSFT]
Hi Dave,

Welcome.

As for the Data creating, do you mean inserting new data record? If so,
this is supported by FormView or DetailsView control. Actually we can
define the InsertTemplate for them which is displayed at runtime when the
formview/detailsView control turn into "Insert" mode.

#Modifying Data Using a FormView Web Server Control  
http://msdn2.microsoft.com/en-us/library/ms227970.aspx

In addition, if you're using some datasource control (like sqldatasource
which have configured insert statement) together with formview/detailsview,
the VS IDE will help automatically generate the insert template.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
17 Mar 2006 6:39 PM
David Thielen
Hi;

This is a big help - I have most of this implemented now - thank you.

A follow-on question. For the <ItemTemplate> the sample has me put <%#
Eval("Title") %> for the data. Is there a way to drag & drop this in in
design mode? Or do I have to type it in in source mode?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



Show quoteHide quote
"Steven Cheng[MSFT]" wrote:

> Hi Dave,
>
> Welcome.
>
> As for the Data creating, do you mean inserting new data record? If so,
> this is supported by FormView or DetailsView control. Actually we can
> define the InsertTemplate for them which is displayed at runtime when the
> formview/detailsView control turn into "Insert" mode.
>
> #Modifying Data Using a FormView Web Server Control  
> http://msdn2.microsoft.com/en-us/library/ms227970.aspx
>
> In addition, if you're using some datasource control (like sqldatasource
> which have configured insert statement) together with formview/detailsview,
> the VS IDE will help automatically generate the insert template.
>
> Hope this helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
Author
17 Mar 2006 7:01 PM
David Thielen
Hi;

Another question. How do I do a new record if I have no records? With no
records I cannot select a record and therefore the FormView is never
displayed - and that is where the New button is.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



Show quoteHide quote
"Steven Cheng[MSFT]" wrote:

> Hi Dave,
>
> Welcome.
>
> As for the Data creating, do you mean inserting new data record? If so,
> this is supported by FormView or DetailsView control. Actually we can
> define the InsertTemplate for them which is displayed at runtime when the
> formview/detailsView control turn into "Insert" mode.
>
> #Modifying Data Using a FormView Web Server Control  
> http://msdn2.microsoft.com/en-us/library/ms227970.aspx
>
> In addition, if you're using some datasource control (like sqldatasource
> which have configured insert statement) together with formview/detailsview,
> the VS IDE will help automatically generate the insert template.
>
> Hope this helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
Author
20 Mar 2006 7:57 AM
Steven Cheng[MSFT]
Hi Dave,

The one you mentioned is databinding expression, there is no toolbox-like
support in vs ide to drag/drop them. However, if you're design the
column(template columns) through the "Edit Template" in design-mode, you
can click the "Edit Databinding" menu in the smartTag of each control, and
in the popup dialog, you can edit the databinding expression.

For your new question on "How do I do a new record if I have no records?",
I think you can consider explictly set the FormView¡¯s "DefaultMode" to
"insert" so that the formview will display the insert template by default:

======================
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataKeyNames="CategoryID"
            DataSourceID="SqlDataSource1" ........  DefaultMode="insert">
====================

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)