PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 2.33 average.

Databinding in InsertItemTemplate of FormView

 
 
Swetha
Guest
Posts: n/a
 
      14th Nov 2005
Hello

I have a FormView with InsertItem, EditItem and ItemTemplates.
Depending on from where the page is accessed, the page opens up in
either Insert, Edit or ReadOnly mode. The FormView is databound. The
problem I have is when the page opens up in Insert Mode. I require one
of the fields to be populated with a databound field, but for some some
reason this doesnt happen in the InsertMode.

Following is the FormView:

<asp:FormView ID="FormView1" runat="server"
DataSourceID="SqlDataSource1" >
<EditItemTemplate>
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton
</EditItemTemplate>
<InsertItemTemplate>
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert"></asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server"
CommandName="Edit" Text="Modify"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Plus32ConnectionString %>"
InsertCommand="addNew" InsertCommandType="StoredProcedure"
SelectCommand="select clientID, name where packageID = @packageID">
<SelectParameters>
<asp:QueryStringParameter Name="packageID"
QueryStringField="packageID" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="clientID" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>

The binding in the InsertItemTemplate does not happen. Can someone
explain why this is happening? And how can I work around this?

 
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
Button.Click event doesn't fire when clicking button in formView.InsertItemTemplate Andy B. Microsoft ASP .NET 0 25th Nov 2009 03:27 PM
FormView Webcontrol Databinding Barry Microsoft Dot NET Framework 0 20th Jul 2008 09:10 AM
FormView: Can we have one template for EditItemTemplate, InsertItemTemplate and ItemTemplate? Max2006 Microsoft ASP .NET 4 29th Aug 2007 02:24 PM
Unique IDs in FormView InsertItemTemplate and EditItemTemplate hooterbite@yahoo.com Microsoft ASP .NET 0 20th Oct 2006 08:19 PM
Formview insertitemtemplate won't populate dropdownlist in Insert Mode jobs at webdos Microsoft ASP .NET 0 9th Oct 2006 04:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:06 PM.