在gridview中使具有特定值的链接不起作用
2011-08-11 17:50
141 查看
//前台
<asp:TemplateField HeaderText="更新">
<HeaderStyle Font-Bold="False" Width="70px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:HyperLink ID="lnkEdit" runat="server" Text="更新" Width="60" NavigateUrl='<%# "CustomerEdit.aspx?Id=" +Eval("Id")%>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
//后台
/// <summary>
/// 行绑定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (((System.Web.UI.WebControls.Label)e.Row.FindControl("lblID")).Text.ToString() == "")
{
((HyperLink)e.Row.FindControl("lnkEdit")).Enabled = false;
}
}
}
<asp:TemplateField HeaderText="更新">
<HeaderStyle Font-Bold="False" Width="70px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:HyperLink ID="lnkEdit" runat="server" Text="更新" Width="60" NavigateUrl='<%# "CustomerEdit.aspx?Id=" +Eval("Id")%>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
//后台
/// <summary>
/// 行绑定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (((System.Web.UI.WebControls.Label)e.Row.FindControl("lblID")).Text.ToString() == "")
{
((HyperLink)e.Row.FindControl("lnkEdit")).Enabled = false;
}
}
}
相关文章推荐
- 在gridview中使具有特定值的链接不起作用
- 类型“GridView”的控件必须放在具有 runat=server 的窗体标记内?
- 过滤特定字符的文本框控件开发(具有特定数据类型的TextBox控件开发)
- 让UILabel具有链接功能,点击后调用safari打开网址
- 固定GridView标题头以及向Head添加元素的一些做法的链接
- 错误提示:类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内
- 定义一个“点”(Point)类用来表示三维空间中的点(有三个坐标)。要求如下: (1)可以生成具有特定坐标的点对象。 (2)提供可以设置三个坐标的方法。 (3)提供可以计算该“点”距原点距离平方的方法。 (4)编写主类程序验证。
- 错误提示:类型“GridView”的控件“GridView1”必须放在具有 runat=server 的窗体标记内
- asp.net GridView中超链接的使用(带参数)
- 类型“GridView”的控件 必须放在具有 runat=server 的窗体标记内
- 未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“jyq.Form1.resources”正确嵌入或链接到程序集“jyq”,或者确保所有需要的附属程序集都可加载并已进行了完全签名
- RaiseCallbackEvent中使用GridView.DataBind不起作用
- GridView中访问特定控件
- GridView中设置日期格式不起作用的解决方法
- 类型“GridView”的控件“ctl00_ContentPlaceHolderMain_gvSelectInfo”必须放在具有 runat=server 的窗体标记内。
- GridView中的超级链接
- Twitter投资人:具有特定功能的小应用方能成功
- 把GridView控件完全放入UpdatePanel中时,实现了点击编辑、更新等按钮时,页面不再刷新,对话框不起作用
- Gridview 中打开链接
- 在GridView使用HyperLinkField 属性的链接