473,659 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disabling Link Button Column in Datagrid

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:ButtonColu mn HeaderText="" ButtonType="Lin kButton" Text="Edit"
CommandName="Ed itRec">
<ItemStyle Font-Bold="false" VerticalAlign=" Top"
HorizontalAlign ="left" Width="30" Height="35"></ItemStyle>
</asp:ButtonColum n>

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
2 10038
Try doing it in the ItemDataBound
Patrick

"pradeep_TP " <pr*******@disc ussions.microso ft.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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:ButtonColu mn HeaderText="" ButtonType="Lin kButton" Text="Edit"
CommandName="Ed itRec">
<ItemStyle Font-Bold="false" VerticalAlign=" Top"
HorizontalAlign ="left" Width="30" Height="35"></ItemStyle>
</asp:ButtonColum n>

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
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:LinkButt on id="LinkButton1 " Enabled =
'<%#Convert.ToI nt16(DataBinder .Eval(Container .DataItem,"empl oyeeid"))==1?Co nvert.ToBoolean ("True"):Conver t.ToBoolean("Fa lse")%>' runat="server">

cheers!
pradeep

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

"pradeep_TP " <pr*******@disc ussions.microso ft.com> wrote in message
news:FE******** *************** ***********@mic rosoft.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:ButtonColu mn HeaderText="" ButtonType="Lin kButton" Text="Edit"
CommandName="Ed itRec">
<ItemStyle Font-Bold="false" VerticalAlign=" Top"
HorizontalAlign ="left" Width="30" Height="35"></ItemStyle>
</asp:ButtonColum n>

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7789
by: Jeelz | last post by:
Hi Guyz, Would appriciate any tip on disabling an ASP.NET LinkButton using client sided code like javascript. My Requirement is such that the user should be allowed to click on the link button only once (viz. he should not be allowed to submit the form twice). This stuff is easy when using a ASP:Button or HTML Button... but a link button has got me wondering how... plz help!
0
1191
by: Douglas Gierow | last post by:
a long time ago, someone asked the question: "I'm using a link button for a Select Button Column in a datagrid. Based on information within the grid I'm doing a response.redirect to a different page. However, I'd like to open a new window. How is this done?" i had the same problem so here's my fix: add a hidden input variable to the html form. set value="0" and
1
390
by: Darren Clark | last post by:
I have a link button that i would like to be used if the value of the text is NOT 0... So the code below will always make a linkbutton.... However if the value of "DataBinder.Eval(Container,"DataItem."+ JR.Core.Data.JobseekerData.FLD_SEARCH_MATCHES) " is 0 i do not want the the 0 to become a link.... I simply want to display it as text. How can i do this? <asp:LinkButton CommandArgument='<%# DataBinder.Eval(Container,"DataItem."+...
1
1240
by: Robin | last post by:
In an ASP.NET page that has a data grid with a bound column of link button. How can I reference the control and set properties for the link button at run time?
2
2363
by: JenHu | last post by:
hi, I have a datagrid in my asp.net application, I am using vb.net language. I want to have my last column as a link column, link to text file. The link path is "c:\Temp\" & F_File_Name, which is the 2nd column. For example, the data grid should like this:
2
2431
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via the Columns dialog box from the properties of the datagrid, on the left that contains a select button. So now, when you press the button the whole row is highlighted. Now, what I want to do is have the user highlight as many rows as they wish...
6
2546
by: sonic | last post by:
Hi, I am experimenting with different viewstate management ideas for large datagrids, and found a microsoft suggestion to turn it off, and only store relevant information by manually accessing viewstate. as per some helpful suggestins in MSDN "Common DataGrid Mistakes" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-commondatagridmistakes.asp they suggest disabling datagrid viewstate and adding...
13
1416
by: John M | last post by:
Hello, In Visual studio .NET 2003, On datagrid object : How can I link the button element : edit, to do a some client events (such as message box, and do another event just after that to the server (do some manipulation on the database).
2
1476
by: Bazza Formez | last post by:
Hello, In my aspx file I have a LinkButton inside a template column, inside a datagrid. I have assigned a CommandName to the button. In my code behind, I attempt to trap the command in the ItemCooamd for the Datagrid. I have used this successfully before with no problems. This time however, the button will not fire ItemCommand.
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.