Hi:
The new databound controls (GridView, DetailsView, ect.) use declaritive
syntax (i.e, setup in HTML at design time). However, at times sql
statements and parameters may need to be derived at runtime. In ASP 1.0 we
could do this in code behind, but how do we do it in ASP 2.0? The examples
I see are setting up controls compeletly at design time.
Thanks,
Charlie 2 1687
You can do whatever you want with a GridView at runtime, e.g.
GridView gv = new GridView();
gv.HeaderRow.Cells.Add(new TableCell());
gv.Width = 500;
gv.AllowSorting = true;
gv.DataSource = MyDataSet();
// ...etc
this.PlaceHolder1.Controls.Add(gv);
gv.DataBind();
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Charlie@CBFC" wrote: Hi:
The new databound controls (GridView, DetailsView, ect.) use declaritive syntax (i.e, setup in HTML at design time). However, at times sql statements and parameters may need to be derived at runtime. In ASP 1.0 we could do this in code behind, but how do we do it in ASP 2.0? The examples I see are setting up controls compeletly at design time.
Thanks, Charlie
Hi Peter,
Does setting the datasource like you said, don't you loose the ability to
use the builtin update and delete functionallity. I just rewote a page
because I did it this way and could not get the newvalues or oldvalues to
work. Just wondering. I'm still working on getting my page to commpletely
work with the update, but its coming along.
Michael
"Peter Bromberg [C# MVP]" wrote: You can do whatever you want with a GridView at runtime, e.g.
GridView gv = new GridView(); gv.HeaderRow.Cells.Add(new TableCell()); gv.Width = 500; gv.AllowSorting = true; gv.DataSource = MyDataSet(); // ...etc this.PlaceHolder1.Controls.Add(gv); gv.DataBind();
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Charlie@CBFC" wrote:
Hi:
The new databound controls (GridView, DetailsView, ect.) use declaritive syntax (i.e, setup in HTML at design time). However, at times sql statements and parameters may need to be derived at runtime. In ASP 1.0 we could do this in code behind, but how do we do it in ASP 2.0? The examples I see are setting up controls compeletly at design time.
Thanks, Charlie This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Shane O. Pinnell |
last post by:
Does anyone know of a resource for information on how to create a working
databound DDL in a datagrid using code behind? I have found a plethora of
resources for doing this without code-behind,...
|
by: clickon |
last post by:
This is driving me nuts, it is such a simply thing to do but i cannot for the
life of me work out how you are suposed to do it. I want to update the data
in DropDownListB based on what is...
|
by: Jeff |
last post by:
hey
asp.net 2.0
I want to programmatically populate (with data from the database) a label
control in a FormView on a webpage.
Is it a good idea to put my logic inside the DataBound event of...
|
by: nzkks |
last post by:
Hi I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Formview controls
In a ASP.Net form I have 20 textboxes and 20 dropdownlists(ddl). All ddl(s) are databound and get...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |