Something like this:
protected void ServerValidation (object source, ServerValidateEventArgs args)
{
try
{
foreach(DataGridItem myDataGridItem in productsGrid.Items)
{
// Get Product Id and test whether it starts with "TP"
string productId = myDataGridItem.Cells[1].Text;
if(productId.StartsWith("TP"))
{
// Get Vendor DropDown Data
DropDownList listVendors =(DropDownList) dgItem.FindControl("ddlVendors");
string vendorName = listVendors.SelectedItem.Text;
// Get Model
TextBox txtModelBox = (TextBox) dgItem.FindControl("txtModel");
// Vendor cannot be "N/A" and Model cannot be empty
if(vendorName.Equals("N/A") || txtModelBox.Text == "" || txtModelBox.Text == null)
args.IsValid = false;
}
}
}
catch
{
args.IsValid = false;
}
}
will this work?
Thanks again,
Justin
P.S.
Just out of curiosity, how did you get your little code snippet to format? I've been on boards where you can do things like this:
[code]
// some code here
// nice and formatted (courier new 10pt)
[/code]
sort of a message board markup language