Getting value from a texbox in asp.net

Posted by user279521 on Stack Overflow See other posts from Stack Overflow or by user279521
Published on 2010-06-03T19:11:18Z Indexed on 2010/06/03 19:14 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

Hi, I have a web page which contains multiple panels (used to show and hide various textboxes) and one particular panel contains textboxes that is used to edit records. However, when I am attemtping to update the table, the txtVendorID.Text.Trim() is blank.

            SqlConnection con = new SqlConnection(strConn);
        string sqlUpdateVendor = "usp_Vendor_Update";
        SqlCommand cmdUpdateVendor = new SqlCommand(sqlUpdateVendor, con);

        cmdUpdateVendor.CommandType = CommandType.StoredProcedure;

        cmdUpdateVendor.Parameters.Add(new SqlParameter("@RecID", SqlDbType.VarChar, 50));
        cmdUpdateVendor.Parameters["@RecID"].Value = Request.QueryString["Rec_ID"];

        cmdUpdateVendor.Parameters.Add(new SqlParameter("@empid", SqlDbType.VarChar, 11));
        cmdUpdateVendor.Parameters["@empid"].Value = txtEmpIDNumber.Text.Trim();

        cmdUpdateVendor.Parameters.Add(new SqlParameter("@VendorName", SqlDbType.VarChar, 100));
        cmdUpdateVendor.Parameters["@VendorName"].Value = txtVendorName.Text.Trim();

Any idea why the textbox does not contain a value?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET