How do i fetch locaion ID and nisert it to table while inserting Items
<p class="col-md-6">
<asp:TextBox ID="txtitem" runat="server" placeholder="Item Name " TextMode="SingleLine"
CssClass="form-control"></asp:TextBox>
</p>
<div class="clearfix">
</div>
<p class="col-md-8">
<asp:Button ID="btnSave" runat="server" CssClass="btn btn-info btn-circle" Text="Save"
Height="50px" Width="100px" CausesValidation="true" OnClick="btnSave_Click" />
<asp:Button ID="btnReset2" runat="server" CssClass="btn btn-default btn-circle" Text="Reset"
Height="50px" Width="100px" OnClick="btnReset2_Click" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</p>
protected void btnSave_Click(object sender, EventArgs e)
{
// lblMessage3.Visible = true;
lblMessage2.Visible = false;
if (txtitem.Text == "")
{
// MessageBox1.ShowError("Enter Date Please");
ScriptManager.RegisterClientScriptBlock(btnSave, this.GetType(), "alert", "<script>alert('Enter Item Name ... !!')</script>", false);
}
else
{
lblMessage2.Text = "";
}
// if (txtunitprice.Text.Length > 0 && txtdiscount2.Text.Length > 0)
{
{
string Currency = ("N");
string constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("InsertItems"))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", Session["userName"]);
cmd.Parameters.AddWithValue("@ItemName", txtitem.Text.Trim()); //Name of rep
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string message = string.Empty;
{
lblMessage2.Visible = true;
lblMessage2.Text = "Data Submitted Successfully";
ScriptManager.RegisterClientScriptBlock(btnSave, this.GetType(), "alert", "<script>alert('Data Submitted Successfully ... !!')</script>", false);
}
// Response.Redirect("Order_Submit.aspx?Message=Data Submitted Successfully");
}
}
}
// else
string a = "33a";
if (a == "a")
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "btnModalPopup();", true);
}
else if (a != "a")
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "btnModalPopup();", true);
}
// {
// lbl.Text = "Data Submitted Sucessfully";
// btnSave.Show();
}
}