I have been stuck with this problem for last couple of days , i have a rad grid it has a master table and a detail table ,there is a custom edit /insert form in the detail table , all the data entries in the detail table will occur through this form the form has some controls and a rad upload control , i have to implement required field validation on the rad upload control which is in the form tempelate , i have read the articles on your site explaining the use of custom validators to achieve the task , but here is the rub , when on server validation event i traverse through the grid it is returning all rows of the detail table but it is not returning the grid edit form item , as i have mentioned the rad upload is in the form item
here is the code that i have used on server validation event
protected void Validatecustom(object source, ServerValidateEventArgs e)
{
e.IsValid = true;
// List<GridDataItem> obj = rgridPersonalAssistant.MasterTableView.DetailTables[0].Items;
foreach (GridDataItem masterrow in rgridPersonalAssistant.MasterTableView.Items)
{
List<GridTableView> cb = masterrow.ChildItem.NestedTableViews.Cast<GridTableView>().ToList();
//rgridPersonalAssistant.e
//views[0].items
foreach (var c in masterrow.ChildItem.NestedTableViews[0].Items)
{
if (c is GridDataItem)
{
GridDataItem cc = c as GridDataItem;
}
if (c is GridEditFormItem)
{
// GridEditFormItem obj = c as GridEditFormItem;
GridEditableItem obj = c as GridEditableItem;
foreach(TableCell cll in obj.Cells)
{
string s = cll.Text;
}
RadUpload objupload = (RadUpload)obj.FindControl("rfScannedDocument");
if (objupload != null)
{
int b = objupload.UploadedFiles.Count;
if (b == 0)
{
e.IsValid = false;
}
}
}
}
}
here is the code that i have used on server validation event
protected void Validatecustom(object source, ServerValidateEventArgs e)
{
e.IsValid = true;
// List<GridDataItem> obj = rgridPersonalAssistant.MasterTableView.DetailTables[0].Items;
foreach (GridDataItem masterrow in rgridPersonalAssistant.MasterTableView.Items)
{
List<GridTableView> cb = masterrow.ChildItem.NestedTableViews.Cast<GridTableView>().ToList();
//rgridPersonalAssistant.e
//views[0].items
foreach (var c in masterrow.ChildItem.NestedTableViews[0].Items)
{
if (c is GridDataItem)
{
GridDataItem cc = c as GridDataItem;
}
if (c is GridEditFormItem)
{
// GridEditFormItem obj = c as GridEditFormItem;
GridEditableItem obj = c as GridEditableItem;
foreach(TableCell cll in obj.Cells)
{
string s = cll.Text;
}
RadUpload objupload = (RadUpload)obj.FindControl("rfScannedDocument");
if (objupload != null)
{
int b = objupload.UploadedFiles.Count;
if (b == 0)
{
e.IsValid = false;
}
}
}
}
}