473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Databinding in InsertItemTemplate of FormView

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?

Nov 19 '05 #1
0 1393

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John Bailey | last post by:
I have a web page with a formview, and a multiview in the formview. When I databind the values inside the multiview views, there is no option for two-way databinding. The form populates fine, but...
3
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
1
by: thzero | last post by:
Is there any way to do this without using the ObjectDataSource? (Apologies for the long post) I have a simple data object: public class TestDO { public TestDO() {} public ID { get; set; }...
2
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry...
0
by: moi | last post by:
Hello, With ASP.NET 2 , i have two dropdownlist, one "A" (not in a formview) in the web page and other one "B" in a Insert Template in a formview. There's a link (parameter between this two...
0
by: Wayne Sepega | last post by:
I have the following Object DataSource <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCustomer" TypeName="Customers" DataObjectTypeName="Customer"...
0
by: jobs at webdos | last post by:
I have a formview that will either edit or insert records into a database. when I call the page with a query string ?x= its goes to edit mode and loads data from a datasource in the form and load...
0
by: hooterbite | last post by:
The forms in Insert and Edit are almost identical, and each fom field has the same name in each template. For example, I have a txbName in the InsertItemTemplate and a txbName in the...
2
by: npei72 | last post by:
I have a simple Formview like this: <%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="HelloWorld.aspx.cs" Inherits="_HelloWorld"%> <html> <body> <form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.