链接按钮在中继器中的特定条件下禁用 [英] Link Button Disable On certain Condition Within Repeater
本文介绍了链接按钮在中继器中的特定条件下禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的转发器中,我有三个字段:userdate,status和reason.当userdate和now日期之间的差异大于7时,我想使Edit linkbutton禁用.
In my repeater I have three fields: userdate,status and reason. I want to make the Edit linkbutton disabled when the diffrence between userdate and now date greater then 7.
推荐答案
尝试
try that
int diff = userdate.Day - DateTime.Now.Day;//this is the difference in days if you want another difference
//ex in mon monthes use userdate.Month and so on
if (diff > 7)
{
// Do something linkbutton.Visible = true;
}
将此行添加到aspx页面链接按钮visible =<%#convert.toboolean(Eval("Enable"))%>并在datatable中使用额外的enable列,并在(diff> 7)dr ["enable"] = false时将此值赋予您的条件,并将此数据表绑定到转发器
add this line in aspx page link button visible=<%#convert.toboolean(Eval("Enable"))%> and take extra enable column in datatable and give this value to behalf of your condition if (diff > 7) dr["enable"]=false and bind this datatable to repeater
这篇关于链接按钮在中继器中的特定条件下禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文