偶做了一个datagrid,
表样如下
存货代码  存货名称   保管员
01         钻头       老高
...         ...        ...
存货名称这一列是超级链接列,属性中设为点击指向所选物料的出库页面fromthe.aspx?id={0}
以上都已经实现了
现在的要求是:如果登录的人是老高,链接正常指向,如果不是老高,不指向fromthe.aspx?id={0},并弹出提示,请求各位大虾,一定帮我啊

解决方案 »

  1.   

    datagrid_itemdataBander方法中判断动态帮定JS方法
    如果不是老高,绑弹出对话框的方法
      

  2.   

    由于是一个hyperlink列,所以一直没找到合适的方法,请大家贴代码给我看看
      

  3.   

    dgData_ItemDataBound事件中判断string subject=Convert.ToString(DataBinder.Eval(e.Item.DataItem,"LawDo_Content"));
    if(subject=="老高")
    {
      (e.Item.FindControl("hyperlink") as hyperlink).Enabled=true;
    }
    else
       (e.Item.FindControl("hyperlink") as hyperlink).Enabled=false;
      

  4.   

    if (e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
    {
    string subject=Convert.ToString(DataBinder.Eval(e.Item.DataItem,"LawDo_Content"));
    if(subject=="老高")
    {
      (e.Item.FindControl("hyperlink") as hyperlink).Enabled=true;
    }
    else
       (e.Item.FindControl("hyperlink") as hyperlink).Enabled=false;}
      

  5.   

    出现错误提示:Server Error in '/inventory' Application.
    --------------------------------------------------------------------------------Object reference not set to an instance of an object. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error: 
    Line 269: else
    Line 270: {
    Line 271: (e.Item.FindControl("HyperLink") as HyperLink).Enabled=false;
    Line 272:
    Line 273: }
     
    我查了一下,e.item.findcontrol[]只能查有ID的控件.像我这里使用的是超级链接绑定列,未发现其ID啊.请高手重新来过