hi
I have textbox and Imagebutton in page that when users click on InsertInfo it will insert txtname's text in to database.
I want if users type space in text box it replace space with "-" like:
neda shabazi Replace with neda-shahbazi so I write below code:
protected void InsertInfo_Click(object sender, ImageClickEventArgs e)
{
ReplaceWord();
InsertInfo();
}
private void ReplaceWord()
{
this.txtname.Text = this.txtname.Text.Replace("-"," ");
}
and:
private void InsertInfo()
{
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand _cmd = General.GetCommand("InsertInfo", conn))
{
conn.Open();
_cmd.Parameters.AddWithValue("@Name", txtname.Text);
_cmd.ExecuteNonQuery();
}
}
}
but here when I type text in textbox and click on button it doesn't do any thing for textbox's text
I mean in database insert neda shahbazi like before...
where is problem?
Best Regards
Neda