|
From: Andy M. <am...@st...> - 2006-06-18 16:17:21
|
I'm not sure why the client side validation is not running, but you can
(should) also run the validation on the server by wrapping the update inside
of a check for IsValid like so:
void dataList_UpdateCommand(object sender, DataListCommandEventArgs
e)
{
if (IsValid)
{
string name =
((System.Web.UI.WebControls.TextBox)e.Item.FindControl("name")).Text;
string birthdate =
((System.Web.UI.WebControls.TextBox)e.Item.FindControl("birthdate")).Text;
TestData.Rows[e.Item.ItemIndex]["name"] = name;
TestData.Rows[e.Item.ItemIndex]["birthdate"] =
DateTime.Parse(birthdate);
dataList.EditItemIndex = -1;
BindList();
}
}
Andy Miller
|