473,569 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid - Databinding a function

Hey all.

I have a question, hope its not hard, searched several groups but
couldn't find nothing like this...

I have a DataGrid with some columns with data on it,
AutoGenerateCol umns=FALSE and a TemplateColumn with a Button on it.

All I want to do is, click the Button, the Button calls a function
that receives a INTEGER like:
doShow(int i) and executes the code.

The problem is the INTEGER needs to be the ID from the current line
(one button per line). The ID is on the datagrid too (but is
VISIBLE=FALSE), so I thought I could easily BIND with <%# tags but I
cant get it to work.

Any help is appreciated, im using c# btw. Thanks.

Apr 26 '07 #1
1 980
Any server control with Visible property set to false doesn't get rendered
to the client and doesn't come back on postbacks. You need to hide it with a
css rule display:none.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Jl_G_0" <jl*********@gm ail.comwrote in message
news:11******** **************@ o40g2000prh.goo glegroups.com.. .
Hey all.

I have a question, hope its not hard, searched several groups but
couldn't find nothing like this...

I have a DataGrid with some columns with data on it,
AutoGenerateCol umns=FALSE and a TemplateColumn with a Button on it.

All I want to do is, click the Button, the Button calls a function
that receives a INTEGER like:
doShow(int i) and executes the code.

The problem is the INTEGER needs to be the ID from the current line
(one button per line). The ID is on the datagrid too (but is
VISIBLE=FALSE), so I thought I could easily BIND with <%# tags but I
cant get it to work.

Any help is appreciated, im using c# btw. Thanks.

Apr 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3111
by: Scott | last post by:
Hi all. A few days ago i ask this question and got a good quick response. I tried out what they said and it worked. However I have now come to try the same thing in another program and it does not seem to be working.
0
2392
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a CheckBox Programmatically" in my code. I have changed it to use a OLDDB.DBReader to populate the datagrid and for the databinding. It works perfectly -...
1
3425
by: Michelle Stone | last post by:
Hi all. I have an empty datagrid on my web form. And I add BoundDataColumn(s) to it through code. But after each postback, the columns and rows disappear. As a workabout, I tried to rebind the datagrid to the dataset (stored in a session variable) on the PageLoad function which works fine. But my datagrid has a button-column called EDIT...
6
1468
by: Ben | last post by:
Hi I've got a problem with a custon control that inherits form the UserControl class and that used the overlib javascript library. The control works well in a standard form but when I used it in a datagrid, the properties that were binded from the database doesn't keep their value through the page_load of the custom control. By using...
4
3227
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
0
1816
by: Daniel Doyle | last post by:
Hello and apologies in advance for the amount of code in this post. I've also sent this message to the Sharepoint group, but thought that ASP.NET developers may also be able to help, even though it's a Sharepoint WebPart. I'm trying to do something fairly simple, create a datagrid that displays where and when a person works and allows them to...
4
2118
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click...
0
1031
by: mcollier | last post by:
I'm trying to develop a page template for the ASP.NET 1.1 project I'm working on. I want to have something like Master Pages (from ASP.NET 2.0). I'm having a problem now with databinding on a simple DataGrid. When the page, PlanCopySelection2.aspx, loads initially it loads, and data binds, correctly. This page has a few checkboxes in the...
3
4316
by: Jl_G_0 | last post by:
Hey all, I need to add a hyperlinkcolumn to a datagrid, but the path (DataNavigateUrlFormatString) is dynamic, since the page lists files in directories. The folder name to list is stored in a variable (strPath). The code that I tried is: DataNavigateUrlFormatString='<%#strPath %>/{0}' But it says: "Databinding expressions are only...
2
1000
by: Mark B | last post by:
I have a Datagrid working fine, outputting: Group Most Popular Product Code -------- ------------------------------- Earth.New Zealand 32 Earth.New Zealand
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
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...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
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...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
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
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.