i've solved it at last with help of Bug_Bugger at
http://forums.asp.net/1116631/ShowPost.aspx
Bug_Bugger says:
Implement RowDataBound event, in it use FindControl to locate the
appropriate controls and set the values
so i did this
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Find control on page.
RangeValidator myControl1 = (RangeValidator) e.Row.FindControl("RngVal");
//RngVal is my control name
//original code was Control myControl1 .... but i changed it to the control
type i need, in this case RangeValidator
if (myControl1 != null)
{
// Get control's parent.
Control myControl2 = myControl1.Parent;
myControl1.MaximumValue = "50"; // i changed this value
myControl1.MinimumValue = "40"; // and this
Response.Write("Parent of the text box is : " + myControl2.ID); // this text
shows control's parent
}
else
{
Response.Write("Control not found");
}
}
and works!!!!
"DS" <> escribió en el mensaje
news: oups.com...
>I have a datagrid with several fields with textboxes and drop downs. I
> want to be able to validate the drop down field in one column to only
> be required if the textbox field in another column has data. Does
> anyone know how to do this?
> I tried to use the compare validator and the custom validator but can't
> figure out how to reference the control from the other column.
> Any help would be greatly appreciated.
> Thanks,
> Deidre
>