要求是给DataGrid行中的dtn_dll点击是判断行中的Img_type和Img_send的ToopTip的值是否有=='是'则返回
ASPX.CS:
((ImageButton)e.Row.FindControl("btn_dll")).Attributes.Add("onclick", " return if(document.getElementById('" + ((Image)e.Row.FindControl("Img_send")).ClientID + "').title=='是'||document.getElementById('" + ((Image)e.Row.FindControl("Img_type")).ClientID + "').title=='是')?false:true");
生成后的ASPX:
<td>
<img id="Order1_gv_list_ctl02_Img_type" title="是" src="/images/yes.gif" style="border-width:0px;" />
</td>
<td>
<img id="Order1_gv_list_ctl02_Img_send" title="否" src="/images/no.jpg" style="border-width:0px;" />
</td>
<td>
<input type="image" name="Order1$gv_list$ctl02$btn_dll" id="Order1_gv_list_ctl02_btn_dll" src="images/icon_del.gif" onclick=" return if(document.getElementById('Order1_gv_list_ctl02_Img_send').title=='是'||document.getElementById('Order1_gv_list_ctl02_Img_type').title=='是')?false:true;" style="border-width:0px;" />
</td>
ASPX.CS:
((ImageButton)e.Row.FindControl("btn_dll")).Attributes.Add("onclick", " return if(document.getElementById('" + ((Image)e.Row.FindControl("Img_send")).ClientID + "').title=='是'||document.getElementById('" + ((Image)e.Row.FindControl("Img_type")).ClientID + "').title=='是')?false:true");
生成后的ASPX:
<td>
<img id="Order1_gv_list_ctl02_Img_type" title="是" src="/images/yes.gif" style="border-width:0px;" />
</td>
<td>
<img id="Order1_gv_list_ctl02_Img_send" title="否" src="/images/no.jpg" style="border-width:0px;" />
</td>
<td>
<input type="image" name="Order1$gv_list$ctl02$btn_dll" id="Order1_gv_list_ctl02_btn_dll" src="images/icon_del.gif" onclick=" return if(document.getElementById('Order1_gv_list_ctl02_Img_send').title=='是'||document.getElementById('Order1_gv_list_ctl02_Img_type').title=='是')?false:true;" style="border-width:0px;" />
</td>
谢谢
如果有返回flash
{
if(document.getElementById(id1).title =="是"||document.getElementById(id2).title =="是")
{
return false;
}
}