VS2005: Formview insert mode - Fill with initial value
Use the FindControl method to automatically fill your controls:
protected void FormView1_PreRender(object sender, EventArgs e)
{
string strDefaultProdName = "Product name";
if (FormView1.CurrentMode == FormViewMode.Insert &&
((TextBox)FormView1.FindControl("ProductNameTextBox")).Text.Length==0)
((TextBox)FormView1.FindControl("ProductNameTextBox")).Text =
strDefaultProdName;
}
Thursday, April 13, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment