User288213138 posted
Hi rhondadunn,
rhondadunn
<form id="form1" data-toggle="validator" role="form">
Note: The server control must be placed inside a form tag with runat=server
rhondadunn
I need to now set the textbox size to the maxlength
If you want to set the textbox size in Bootstrap, you can use classes like 'col-xs-2' or 'col-xs-3' .
<div class="col-xs-2">
<asp:TextBox ID="txtSSNO" runat="server" type="text" class="form-control" MaxLength="11"></asp:TextBox>
</div>
More information about Bootstrap Sizing you can refer to this link:https://www.w3schools.com/bootstrap/bootstrap_forms_sizing.asp
rhondadunn
The other issue I am having is how to save the input text to the database.
You can use Ado.Net to save the data to database. The below code for you as a reference:
protected void btnSubmit_Click(object sender, EventArgs e)
{
string ssno = txtSSNO.Text;
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO Test55 VALUES(@Text)"))
{
cmd.Parameters.AddWithValue("@Text", ssno);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
rhondadunn
For the textbox, I use string ssno = txtssno.text;. However, this does not work with an input in Bootstrap
If you want to get the input value in code behind, you can try below code:
string name = String.Format("{0}", Request.Form["txtSSNO"]);
Best regards,
Sam