Tags: ado, assign, datagrid, diffrerent, hyperlink, net, page, rights, user, web

hyperlink datagrid

On .Net » .Net ADO

1,599 words with 1 Comments; publish: Tue, 01 Jan 2008 01:53:00 GMT; (10064.45, « »)

i use one datagrid in my web page.now i have 5 different user each have diffrerent rights(let user are 1,2 3,4,5).i assign user 1 a,b,c rights same way 2,3,4,5 but all have different rights.now i want when user 1 login data grid display only a,b,c option and when he click a open "a.aspx page", when he click b open "b.aspx" page like all.when user 2 login he show "d,e,f" etc.when he click "d" open d.aspx page etc.Now i do all that in asp.net(C#) that datagride is view in each page.can any one send me source code according my need.my E-Mail id [contact.ashishkumar.net-ado.itags.org.gmail.com]

All Comments

Leave a comment...

  • 1 Comments
    • In aspx page

      <asp:DataGrid id="DG" runat="server" AutogenerateColumns="False">

      <Columns>

      <asp:TemplateColumn>

      <ItemTemplate>

      <asp:HyperLink runat="server" text='<%# Container.DataItem("ColA") %>' NavigateUrl='<%# Container.DataItem("ColA") & ".aspx" %>' Visible='<%# CheckVisible() %>' />

      </ItemTemplate>

      </asp:TemplateColumn>

      </Columns>

      </asp:DataGrid>

      In the code-behind

      Public Function CheckVisible() as Boolean

      ' Check if the user has rights to view this column

      if user.CanViewA

      return true

      else

      return false

      end if

      End Function

      Note: The code is in VB, but it is very simple, so converting should not be a problem. I have also shown only one column in the DG. As I have typed the code straight here, there might be Typo mistakes.

      #1; Tue, 01 Jan 2008 01:54:00 GMT