|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FormView vs createHi;
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. 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.) 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? 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.) > > 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. 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.) > > 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.)
How to get CommandField and ButtonField in the toolbox?
Binding TextBox Gridview custom sort - works but always sorts ascending Perform insert to gridview/table DropDownlist problem Disable CommandField for some rows of data Creating Dynamic controls Datalist formatting questions Adding client side code to RadioButtonList control item??? Searching a list box using a text box |
|||||||||||||||||||||||