473,698 Members | 2,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datalist - create diff. controls in same column

Hi,

I have a datalist which has a column with data from a database. I
would like the column to either show a textbox with the value of the
data field, or a button. The contol created would depend on the value
of the data field.

i.e. if data value < 10 then create textbox with value of data
else
create a button.

i can create the textbox easy enough within the ItemTemplate, but
creating either the textbox Or a button is where I need help

anyone?
Nov 18 '05 #1
1 1050
Hi

The easiest and best way it to create an dynamic template and add textbox or button dymanically by setting the condition.

Below articles shows how to add dynamic template
http://www.dotnetjunkies.com/Tutoria...063C4C9BBC.dci
http://www.asptoday.com/Content.aspx?id=113

Regards

Vinodh Kuma
Microsoft MVP|Author|Arc
www.dotnetforce.co
Force Behind .NE
----- Mortar wrote: ----

Hi

I have a datalist which has a column with data from a database.
would like the column to either show a textbox with the value of th
data field, or a button. The contol created would depend on the valu
of the data field.

i.e. if data value < 10 then create textbox with value of dat
els
create a button

i can create the textbox easy enough within the ItemTemplate, bu
creating either the textbox Or a button is where I need hel

anyone

Nov 18 '05 #2

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

Similar topics

3
4944
by: olle | last post by:
Hi everyone. Beging a newbee to asp.net and used to work with traditional asp I have one problem working with a datalist. 1/ I make a dataset as as session variable like session("employees") 2/ I want the datalist do display only the first row of the table. But it always fails. tried for exemple: dim nrowpos as ingeger 'shows the current rowposition dim dv as dataview
0
3106
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format. However, the DataGrid begins to get very cumbersome as the number of columns of data you present increases. Anything more than half a dozen columns or so and you probably induce horizontal scrolling - a real no-no for me. If you put such a...
1
2671
by: Scott Schluer | last post by:
Hello, I've got myself a small problem and I'm hoping someone can help. I have a DataList called dlProducts (displays products from a database). Within the <ItemTemplate> container of the DataList, I have a PlaceHolder control called phVariations. During the ItemDataBound event for dlProducts, I dynamically create a few DropDownLists (again, from a database) and .Add the DropDownList to the PlaceHolder control. That all works just...
4
2481
by: Joe Van Meer | last post by:
Hi, Is the datalist meant for one table or can I use it to display information from 2 different tables? Or should I be looking at a datagrid instead? I began my code and kinda ran into a snag where my last two columns I am displaying are ID fields, one for clientid and the other for empid. What I would really like is to display their actual names instead of the ids.
1
1214
by: Mihai_Panait | last post by:
I'm trying to build a commerce site and i can't understand why my DataList controls acts diferent with the same code in the same page My database contains amoung others 'category', 'subcategory' and 'product' I have a DataList for each column in the database. when i select a category from the cathegory DataList - the Subcategory DataList loads, and when i click on a subcategory the Product DataList loads, and in the end when i choose a product...
8
7431
by: Adam Billmeier | last post by:
Problem: I am trying to use FindControl to grab a dropdownlist that is in the EditItemTemplate of a Datalist and then Bind it to a dataset. I also then need to put the correct values in all of the text boxes in the EditItemTemplate. I have set the EditItemIndex for the Datalist to -1, and then bound the Datalist. I then want to Bind the DropDown, and populate the values. All attempts to use FindControl on the control return "Nothing"
10
2848
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
5
3775
by: Ben Fidge | last post by:
I'm using DataList to present tabular data but am often having problems with some rows column alignment being out of synch with the rest of the rows. My DataList looks similar to this...: <asp:datalist id="DataList1" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="400"> <tr> <td width="100">First Name</td>
1
5082
by: David Lozzi | last post by:
Howdy, I have a datalist which is displaying a list of categories and their associated sub categories in secondary datalists. Works great in a single column. Unfortunaly when i switch it to repeatcolumn = 2 (or three or anything over 1) , the data is displayed quite erratically, for example category 1 category 3 sub 1 sub 1 sub 2
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
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
7741
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...
1
6531
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
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
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.