By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

Disabling Link Button Column in Datagrid

P: n/a
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
Nov 25 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try doing it in the ItemDataBound
Patrick

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
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

Nov 25 '05 #2

P: n/a
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.Data Item,"employeeid"))==1?Convert.ToBoolean("True"):C onvert.ToBoolean("False")%>' runat="server">

cheers!
pradeep

"Patrick.O.Ige" wrote:
Try doing it in the ItemDataBound
Patrick

"pradeep_TP" <pr*******@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
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


Nov 25 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.