Disabling Link Button Column in Datagrid

Discussion in 'ASP .Net' started by =?Utf-8?B?cHJhZGVlcF9UUA==?=, Nov 25, 2005.

  1. Hello world,



    I have a simple datagrid on asp.net web form , in which I am showing a
    single button column called EDIT. The code in the .aspx files for the same is
    as below.

    <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
    CommandName="EditRec">
    <ItemStyle Font-Bold="false" VerticalAlign="Top"
    HorizontalAlign="left" Width="30" Height="35"></ItemStyle>
    </asp:ButtonColumn>

    Currently, I am displaying this Edit link button for every record in the
    datagrid. I want to know how can i selectively disable EDIT link button for
    few records based on what value is in any single datagrid column. I need to
    disable it through the code and NOT when the user does anything on the screen.

    (I am using ASP.NET 1.1)

    Any ideas

    thanks all
    pradeep_TP
    =?Utf-8?B?cHJhZGVlcF9UUA==?=, Nov 25, 2005
    #1
    1. Advertising

  2. Try doing it in the ItemDataBound
    Patrick

    "pradeep_TP" <> wrote in message
    news:...
    > Hello world,
    >
    >
    >
    > I have a simple datagrid on asp.net web form , in which I am showing a
    > single button column called EDIT. The code in the .aspx files for the same

    is
    > as below.
    >
    > <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
    > CommandName="EditRec">
    > <ItemStyle Font-Bold="false" VerticalAlign="Top"
    > HorizontalAlign="left" Width="30" Height="35"></ItemStyle>
    > </asp:ButtonColumn>
    >
    > Currently, I am displaying this Edit link button for every record in the
    > datagrid. I want to know how can i selectively disable EDIT link button

    for
    > few records based on what value is in any single datagrid column. I need

    to
    > disable it through the code and NOT when the user does anything on the

    screen.
    >
    > (I am using ASP.NET 1.1)
    >
    > Any ideas
    >
    > thanks all
    > pradeep_TP
    Patrick.O.Ige, Nov 25, 2005
    #2
    1. Advertising

  3. thank you patrick. I have solved the problem myself :). Following is what I did

    1) Added a template column and inside it i added a linkButton server control.
    2) The enabled property of the link button was set as below

    <asp:LinkButton id="LinkButton1" Enabled =
    '<%#Convert.ToInt16(DataBinder.Eval(Container.DataItem,"employeeid"))==1?Convert.ToBoolean("True"):Convert.ToBoolean("False")%>' runat="server">

    cheers!
    pradeep

    "Patrick.O.Ige" wrote:

    > Try doing it in the ItemDataBound
    > Patrick
    >
    > "pradeep_TP" <> wrote in message
    > news:...
    > > Hello world,
    > >
    > >
    > >
    > > I have a simple datagrid on asp.net web form , in which I am showing a
    > > single button column called EDIT. The code in the .aspx files for the same

    > is
    > > as below.
    > >
    > > <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
    > > CommandName="EditRec">
    > > <ItemStyle Font-Bold="false" VerticalAlign="Top"
    > > HorizontalAlign="left" Width="30" Height="35"></ItemStyle>
    > > </asp:ButtonColumn>
    > >
    > > Currently, I am displaying this Edit link button for every record in the
    > > datagrid. I want to know how can i selectively disable EDIT link button

    > for
    > > few records based on what value is in any single datagrid column. I need

    > to
    > > disable it through the code and NOT when the user does anything on the

    > screen.
    > >
    > > (I am using ASP.NET 1.1)
    > >
    > > Any ideas
    > >
    > > thanks all
    > > pradeep_TP

    >
    >
    >
    =?Utf-8?B?cHJhZGVlcF9UUA==?=, Nov 25, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Timney \(ASP.NET MVP\)

    Re: disabling link button on a datagrid in .Net

    John Timney \(ASP.NET MVP\), Mar 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    513
    John Timney \(ASP.NET MVP\)
    Mar 7, 2005
  2. =?Utf-8?B?V2FyYW4=?=

    HyperLink Column and Button Column in a DataGrid

    =?Utf-8?B?V2FyYW4=?=, Aug 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    600
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  3. Replies:
    2
    Views:
    772
    Jonathan N. Little
    May 15, 2008
  4. Sharad Nair

    Disabling Datagrid Link Button

    Sharad Nair, Aug 8, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    168
  5. susan

    databound column to hyper link column

    susan, Jan 8, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    133
    S. Hussain Akbar
    Jan 12, 2004
Loading...

Share This Page