FormView Manual Data binding
<p>I have a FormView that I user for updating a record. There is a link button that when fires should perforom the updating via BLL and DAL. I am not using built-in ODS and I will not condsider using it.</p>

<p>I have all my grids and formviews populated manuualy by calling methods that fetch the data from the database.</p>

<p>For instance my details view is populated like this:</p>

<pre><code>protected void DlMembers_ItemCommand(object source, DataListCommandEventArgs e)
{
    if (e.CommandName.ToString() == "Select")
    {
        DlMembers.Visible = false;
        lblError.Text = string.Empty;
        lblError.Visible = false;
        fvMemberDetail.Visible = true;
        fvMemberDetail.ChangeMode(FormViewMode.Edit);

        MemberBLL getMemberInfo = new MemberBLL();

        int Ident = Convert.ToInt32(e.CommandArgument.ToString());

        fvMemberDetail.DataSource = getMemberInfo.GetMemberByIdent(Ident);
        fvMemberDetail.DataBind();

    }

    if (e.CommandName.ToString() == "DeleteSelected")
    {
        DlMembers.Visible = true;
        lblError.Text = string.Empty;
        lblError.Visible = false;
        fvMemberDetail.Visible = false;
        fvMemberDetail.ChangeMode(FormViewMode.ReadOnly);
  }
</code></pre>

<p>What I want to do if to capature my linkbutton on click event and do this (except that the runtime never reaches this method):</p>

<pre><code>protected void MemberInfoUpdating(object sender, EventArgs e)
{
    TextBox id = (TextBox)fvMemberDetail.FindControl("txtIdent");

    if (id.Text != string.Empty || id.Text != "")
    {
        TextBox txtFN = (TextBox)fvMemberDetail.FindControl("txtFN");
        TextBox txtLN = (TextBox)fvMemberDetail.FindControl("txtLN");
        DropDownList ddlAddress = (DropDownList)fvMemberDetail.FindControl("ddlAddress");
        TextBox txtEmail = (TextBox)fvMemberDetail.FindControl("txtEmail");
        TextBox txtHPhone = (TextBox)fvMemberDetail.FindControl("txtHPhone");
        TextBox txtWPhone = (TextBox)fvMemberDetail.FindControl("txtWPhone");
        TextBox txtMPhone = (TextBox)fvMemberDetail.FindControl("txtMPhone");
        DropDownList ddlPos = (DropDownList)fvMemberDetail.FindControl("ddlPos");
        DropDownList ddlIsAdmin = (DropDownList)fvMemberDetail.FindControl("ddlIsAdmin");
        bool blIsAdmin = false;
        if (ddlIsAdmin.SelectedValue == "True") blIsAdmin = true;
        TextBox txtComments = (TextBox)fvMemberDetail.FindControl("txtComments");

        MemberBLL updateMemberInfo = new MemberBLL();

        bool UpdateOK = updateMemberInfo.UpdateMemberByIdent(
                        txtFN.Text,
                        txtLN.Text,
                        ddlAddress.SelectedValue,
                        txtEmail.Text,
                        txtHPhone.Text,
                        txtWPhone.Text,
                        txtMPhone.Text,
                        blIsAdmin,
                        txtComments.Text,
                        Convert.ToInt32(ddlPos.SelectedValue),
                        Convert.ToInt32(id.Text));
    }
    else
    {
        //Display error - no user id cannot update record
    }
}
</code></pre>

<p>The linkbutton looks like this: </p>

<pre><code>&lt;asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                OnClick="MemberInfoUpdating" Text="Update" /&gt;
</code></pre>
