Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2006, 04:10 PM
Registered User
 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How does Update Link in FormView work? URGENT

Hi friends,

Somehow i am stuck at a very basic step. I have two pages -


1. DomainList.aspx which just displays all the records from the Domains
table.
2. DomainAddEdit.aspx which displays the selected record in
FormView(Edit Mode) with two link for Update and Cancel.


The Update link in the FormView does nothing on the first click. It
just reloads the page with the new data I entered. If I click again on
the Update link, it throws me an error:


"Cannot insert the value NULL into column 'DNS', table
'MSInteractive.dbo.Domains'; column does not allow nulls. UPDATE fails.
The statement has been terminated. "


I have no clue why all this is happening. I have spent more than two
days on this and this is very very frustrating.


Just to mention, I haven't written any code for this. Its developed all
using the VWD tools available. I have posted this message earlier but
haven't got any response. I am sure most of you guys must have been
doing these steps everyday. So, please post your thoughts. Thanks a
million.


Here is the relevant code for my DomainADDEdit.aspx:


<asp:FormView ID="FormView1" runat="server"
DataSourceID="SqlDataSource1" DefaultMode="Edit">
        <EditItemTemplate>
            Id:
            <asp:TextBox ID="IdTextBox" runat="server" Text='<%#
Bind("Id") %>'></asp:TextBox><br />
            RegistrarAccountId:
            <asp:TextBox ID="RegistrarAccountIdTextBox" runat="server"
Text='<%# Bind("RegistrarAccountId") %>'></asp:TextBox><br />
            Registrar:
            <asp:TextBox ID="RegistrarTextBox" runat="server" Text='<%#
Bind("Registrar") %>'></asp:TextBox><br />
            DNS:
            <asp:TextBox ID="DNSTextBox" runat="server"
AutoPostBack="True" OnTextChanged="DNSTextBox_TextChanged"
                Text='<%# Bind("DNS") %>'></asp:TextBox><br />
            EmailHost:
            <asp:TextBox ID="EmailHostTextBox" runat="server" Text='<%#
Bind("EmailHost") %>'></asp:TextBox><br />
            Registered:
            <asp:TextBox ID="RegisteredTextBox" runat="server"
Text='<%# Bind("Registered") %>'></asp:TextBox><br />
            Expires:
            <asp:TextBox ID="ExpiresTextBox" runat="server" Text='<%#
Bind("Expires") %>'></asp:TextBox><br />
            MsiResponsible:
            <asp:CheckBox ID="MsiResponsibleCheckBox" runat="server"
Checked='<%# Bind("MsiResponsible") %>' />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MSInteractiveConnectionString
%>"
        SelectCommand="SELECT [Id], [RegistrarAccountId], [Registrar],
[DNS], [EmailHost], [Registered], [Expires], [MsiResponsible] FROM
[Domains] WHERE ([Id] = @Id)"
        UpdateCommand="UPDATE Domains SET DNS = @txtDNS WHERE (Id =
@Id)">
        <UpdateParameters>
            <asp:FormParameter FormField="DNSTextBox" Name="txtDNS" />
            <asp:QueryStringParameter Name="Id" QueryStringField="Id"
/>
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="Id" QueryStringField="Id"
Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
<br />
            <asp:LinkButton ID="UpdateButton" runat="server"
CommandName="Update"
                Text="Update"
OnClick="UpdateButton_Click"></asp:LinkButton>
            <asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
                Text="Cancel"></asp:LinkButton>
        </EditItemTemplate>









Similar Threads
Thread Thread Starter Forum Replies Last Post
Update link doesn't update in FormsView shaly ASP.NET 2.0 Basics 0 December 6th, 2006 04:33 PM
File Link Won't Work Ron Howerton ASP.NET 1.0 and 1.1 Basics 13 November 3rd, 2006 12:54 PM
formview please urgent help jameee ASP.NET 2.0 Professional 2 September 15th, 2006 05:18 PM
Extra conditional update click event in FormView nuttylife2 ASP.NET 2.0 Professional 1 July 31st, 2006 08:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.