can anyone tell me what's wrong with my codes below..what does this error mean and how can i get rid of it...looking forward for your help..

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView Example</h3>

        <table cellspacing="10">
            
          <tr>
            <td>
              <asp:GridView ID="ClientGridView" 
                DataSourceID="ClientSqlDataSource" 
                AutoGenerateColumns="false"
                DataKeyNames="ClientID" 
                OnSelectedIndexChanged="ClientGridView_OnSelectedIndexChanged"
                RunAt="Server">
                
                <HeaderStyle backcolor="Navy"
                  forecolor="White" />
                
                <Columns>
                
                  <asp:ButtonField Text="Details..."
                    HeaderText="Show<BR>Details"
                    CommandName="Select"/>  
                
                  <asp:BoundField DataField="ClientName" HeaderText="Client Name"/>
                  <asp:BoundField DataField="Address"   HeaderText="Address"/>                        
                  <asp:BoundField DataField="ContactPerson"  HeaderText="Contact Person"/>
                    
                </Columns>
                
              </asp:GridView>
            
            </td>
                
            <td valign="top">
                
              <asp:FormView ID="ClientFormView"
                DataSourceID="ClientSqlDataSource"
                DataKeyNames="ClientID"     
                Gridlines="Both" 
                OnItemUpdated="ClientFormView_ItemUpdated"
                OnItemDeleted="ClientFormView_ItemDeleted"      
                RunAt="server">
                
                <HeaderStyle backcolor="Navy"
                  forecolor="White"/>
                  
                <RowStyle backcolor="White"/>         
                
                <EditRowStyle backcolor="LightCyan"/>
                                    
                <ItemTemplate>
                  <table>
                    <tr><td align="right"><b>Client ID:</b></td><td><%# Eval("ClientId") %></td></tr>
		    <tr><td align="right"><b>Client Name:</b></td>  <td><%# Eval("ClientName") %></td></tr>
                    <tr><td align="right"><b>Address:</b></td> <td><%# Eval("Address") %></td></tr>
                    <tr><td align="right"><b>Contact Person:</b></td>  <td><%# Eval("ContactPerson") %></td></tr>		
		    <tr><td align="right"><b>Telephone No.:</b></td>  <td><%# Eval("TelNo") %></td></tr>
		    <tr><td align="right"><b>Email:</b></td>  <td><%# Eval("Email") %></td></tr>
                    <tr>
                      <td colspan="2">
                        <asp:LinkButton ID="EditButton"
                                        Text="Edit"
                                        CommandName="Edit"
                                        RunAt="server"/>
                        &nbsp;
                        <asp:LinkButton ID="NewButton"
                                        Text="New"
                                        CommandName="New"
                                        RunAt="server"/>
                        &nbsp;
                        <asp:LinkButton ID="DeleteButton"
                                        Text="Delete"
                                        CommandName="Delete"
                                        RunAt="server"/>
                      </td>
                    </tr>
                  </table>                 
                </ItemTemplate>

                <EditItemTemplate>
                  <table>
                  
                   <tr><td align="right"><b>User:</b></td>
                        <td><asp:TextBox ID="UserTextBox" 
                                         Text='<%# Bind("UserId") %>' 
                                         RunAt="Server" /></td></tr>
                      

                    <tr><td align="right"><b>Project:</b></td>
                        <td><asp:TextBox ID="ProjectTextBox" 
                                         Text='<%# Bind("ProjectId") %>' 
                                         RunAt="Server" /></td></tr>
                    
                    <tr><td align="right"><b>Client Name:</b></td>
                        <td><asp:TextBox ID="EditClientNameTextBox" 
                                         Text='<%# Bind("ClientName") %>' 
                                         RunAt="Server" /></td></tr>

                    <tr><td align="right"><b>Address:</b></td>
                        <td><asp:TextBox ID="EditAddressTextBox" 
                                         Text='<%# Bind("Address") %>' 
                                         RunAt="Server" /></td></tr>
                                         
                                         
                    <tr><td align="right"><b>Contact Person:</b></td>
                        <td><asp:TextBox ID="EditContactPersonTextBox" 
                                         Text='<%# Bind("ContactPerson") %>' 
                                         RunAt="Server" /></td></tr>

                    <tr><td align="right"><b>Telephone Number:</b></td>
                        <td><asp:TextBox ID="EditTelNoTextBox" 
                                         Text='<%# Bind("TelNo") %>' 
                                         RunAt="Server" /></td></tr>
                                         
                    <tr><td align="right"><b>Email:</b></td>
                        <td><asp:TextBox ID="EditEmailTextBox" 
                                         Text='<%# Bind("Email") %>' 
                                         RunAt="Server" /></td></tr>
                    <tr>
                      <td colspan="2">
                        <asp:LinkButton ID="UpdateButton"
                                        Text="Update"
                                        CommandName="Update"
                                        RunAt="server"/>
                        &nbsp;
                        <asp:LinkButton ID="CancelUpdateButton"
                                        Text="Cancel"
                                        CommandName="Cancel"
                                        RunAt="server"/>
                      </td>
                    </tr>
                  </table>                 
                </EditItemTemplate>

                <InsertItemTemplate>
                  <table>
                    
                   <tr><td align="right"><b>User:</b></td>
                        <td><asp:TextBox ID="UserTextBox" 
                                         Text='<%# Bind("UserId") %>' 
                                         RunAt="Server" /></td></tr>
                   
                    <tr><td align="right"><b>Project:</b></td>
                        <td><asp:TextBox ID="ProjectTextBox" 
                                         Text='<%# Bind("ProjectId") %>' 
                                         RunAt="Server" /></td></tr>
                    
                    <tr><td align="right"><b>Client Name:</b></td>
                        <td><asp:TextBox ID="EditClientNameTextBox" 
                                         Text='<%# Bind("ClientName") %>' 
                                         RunAt="Server" /></td></tr>

                    <tr><td align="right"><b>Address:</b></td>
                        <td><asp:TextBox ID="EditAddressTextBox" 
                                         Text='<%# Bind("Address") %>' 
                                         RunAt="Server" /></td></tr>
                                         
                                         
                    <tr><td align="right"><b>Contact Person:</b></td>
                        <td><asp:TextBox ID="EditContactPersonTextBox" 
                                         Text='<%# Bind("ContactPerson") %>' 
                                         RunAt="Server" /></td></tr>

                    <tr><td align="right"><b>Telephone Number:</b></td>
                        <td><asp:TextBox ID="EditTelNoTextBox" 
                                         Text='<%# Bind("TelNo") %>' 
                                         RunAt="Server" /></td></tr>
                                         
                    <tr><td align="right"><b>Email:</b></td>
                        <td><asp:TextBox ID="EditEmailTextBox" 
                                         Text='<%# Bind("Email") %>' 
                                         RunAt="Server" /></td></tr>

                    <tr>
                      <td colspan="2">
                        <asp:LinkButton ID="InsertButton"
                                        Text="Insert"
                                        CommandName="Insert"
                                        RunAt="server"/>
                        &nbsp;
                        <asp:LinkButton ID="CancelInsertButton"
                                        Text="Cancel"
                                        CommandName="Cancel"
                                        RunAt="server"/>
                      </td>
                    </tr>
                  </table>                 
                </InsertItemTemplate>
                    
              </asp:FormView>

            </td>
                
          </tr>
            
        </table>
            
        <asp:sqlDataSource ID="ClientSqlDataSource"  
          selectCommand="SELECT * FROM [Client] WHERE ([UserId]= @UserId)" 
          InsertCommand="INSERT INTO Client(UserId, ProjectId, ClientName, Address, ContactPerson, TelNo, Email) VALUES (@ProjectId, @ClientName, @Address, @ContactPerson, @TelNo, @Email); 
                         SELECT @ClientId = SCOPE_IDENTITY()"
          UpdateCommand="UPDATE Client SET UserId=@UserId, ProjectId=@ProjectId, ClientName=@ClientName, Address=@Address, ContactPerson=@ContactPerson, TelNo=@TelNo, Email=@Email 
                           WHERE ClientId=@ClientId"
          DeleteCommand="DELETE Client WHERE ClientId=@ClientId"
          connectionstring="<%$ ConnectionStrings:TrialConnectionString %>" 
          RunAt="server" oninserted="ClientqlDataSource_Inserted">
            <SelectParameters>
            <asp:Parameter Name="ClientId" Type="Int32" DefaultValue="0" />
          </SelectParameters>
          
          <InsertParameters>
            <asp:Parameter Name="ClientId" Direction="Output" Type="Int32" DefaultValue="0" />
          </InsertParameters>
          
          </asp:sqlDataSource>
 
      </form>
  </body>
</html>



protected void ClientGridView_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        ClientSqlDataSource.SelectParameters["ClientId"].DefaultValue =
      ClientGridView.SelectedValue.ToString();
        ClientFormView.DataBind();
    }
    protected void ClientFormView_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {
        ClientGridView.DataBind();
    }
    protected void ClientFormView_ItemDeleted(object sender, FormViewDeletedEventArgs e)
    {
        ClientGridView.DataBind();
    }
    protected void ClientqlDataSource_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {
        System.Data.Common.DbCommand command = e.Command;

        ClientSqlDataSource.SelectParameters["ClientId"].DefaultValue =
          command.Parameters["@ClientId"].Value.ToString();

        ClientGridView.DataBind();
        ClientFormView.DataBind();
    }

Hi there fayenot, could you please post the exact error message? I have come across this one before myself I think. Also please use code tags :)

Hey friends i had the same problem!!!! my solution was this:
html:
<asp:FormParameter Name="nombre" FormField="nombre" />
codebehind:
string nombre = Request.Form["nombre"];

Welcome kelvinguz.

Please do not resurrect old threads. If you have any questions please ask. You are welcome to start your own threads.


Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.