I have tried many solutions found online that seemed to work for others but not working for me, can someone please tell me if there is something else I have to do to make this work?
I simply need to add default value to TextBox when using ListView.
online example 1:
protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
{
TextBox DateAssignedTextBox = (TextBox)e.Item.FindControl("DateAssignedTextBox");
DateAssignedTextBox.Text = DateTime.Now.ToString();
}
online example 2:
protected void ListView1_DataBound(object sender, EventArgs e)
{
TextBox tb = (TextBox)ListView1.InsertItem.FindControl("TextBox1");
tb.Text = "any_text";
}
online example 3:
((TextBox)myDetailsView.InsertItem.FindControl("TextBox1")).Text =
DateTime.Now.ToString("M/d/yyyy HH:mm");
I simply need to add default value to TextBox when using ListView.
online example 1:
protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
{
TextBox DateAssignedTextBox = (TextBox)e.Item.FindControl("DateAssignedTextBox");
DateAssignedTextBox.Text = DateTime.Now.ToString();
}
online example 2:
protected void ListView1_DataBound(object sender, EventArgs e)
{
TextBox tb = (TextBox)ListView1.InsertItem.FindControl("TextBox1");
tb.Text = "any_text";
}
online example 3:
((TextBox)myDetailsView.InsertItem.FindControl("TextBox1")).Text =
DateTime.Now.ToString("M/d/yyyy HH:mm");