473,803 Members | 4,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can CheckBoxList items be used in SelectParameter s of ODS

Hi,

I have a CheckBoxList on a page and an Object Data Source which expects
values from the list as its select parameters. Is there a way to
declaratively define select parameters to reference items in the check box
list?

Example:
<asp:CheckBoxLi st ID="cblTypes" runat="server" AutoPostBack="T rue"
RepeatDirection ="Horizontal " RepeatLayout="F low" CssClass="legen d"
onselectedindex changed="cblTyp es_SelectedInde xChanged">
<asp:ListItem Selected="True" Value="1">Type1 </asp:ListItem>
<asp:ListItem Value="2">Type2 </asp:ListItem>
<asp:ListItem Value="1">Type3 </asp:ListItem>
</asp:CheckBoxLis t>

[...]

<asp:ObjectData Source ID="odsElements " runat="server"
OldValuesParame terFormatString ="{0}"
SelectMethod="G etElementsByUse rId" TypeName="Eleme ntsBLL">
<SelectParamete rs>
<asp:SessionPar ameter Name="userId" SessionField="U serId" Type="String" />
[...]
</SelectParameter s>
</asp:ObjectDataS ource>

The BLL's select method has the following signature:
public Elements.Elemen tDataTable ElementsBLL.Get ElementsByUserI d(string
userId, short type1, short type2, short type3)

If this cannot be done declaratively then what is the best approach if the
ODS provides data to a GridView control?

Thanks,
Bogdan
Sep 25 '08 #1
1 2579
Unfortunately the ListItem class is a sealed class.
You cannot inherit from it and add any new preoperties to it.

Again unfortunately, it also does not have any 'tag' property of type Object
on which you would hang your custom class with metadata.

You would have to whrite your own CheckBoxList component, or get a 3rd party
one.

"Bogdan" wrote:
Hi,

I have a CheckBoxList on a page and an Object Data Source which expects
values from the list as its select parameters. Is there a way to
declaratively define select parameters to reference items in the check box
list?

Example:
<asp:CheckBoxLi st ID="cblTypes" runat="server" AutoPostBack="T rue"
RepeatDirection ="Horizontal " RepeatLayout="F low" CssClass="legen d"
onselectedindex changed="cblTyp es_SelectedInde xChanged">
<asp:ListItem Selected="True" Value="1">Type1 </asp:ListItem>
<asp:ListItem Value="2">Type2 </asp:ListItem>
<asp:ListItem Value="1">Type3 </asp:ListItem>
</asp:CheckBoxLis t>

[...]

<asp:ObjectData Source ID="odsElements " runat="server"
OldValuesParame terFormatString ="{0}"
SelectMethod="G etElementsByUse rId" TypeName="Eleme ntsBLL">
<SelectParamete rs>
<asp:SessionPar ameter Name="userId" SessionField="U serId" Type="String" />
[...]
</SelectParameter s>
</asp:ObjectDataS ource>

The BLL's select method has the following signature:
public Elements.Elemen tDataTable ElementsBLL.Get ElementsByUserI d(string
userId, short type1, short type2, short type3)

If this cannot be done declaratively then what is the best approach if the
ODS provides data to a GridView control?

Thanks,
Bogdan
Sep 26 '08 #2

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

Similar topics

0
5817
by: rob | last post by:
Here is my scenario: One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView. Then I have a database that has the columns Item1 and Item2 (among others) with the data type bit. What I am trying to do is to only show the data sets chosen by the user. So for example if the user checks Item1 in the CheckBoxList then only the datasets that have Item1 set to True should be listed in the GridView. Here is what I tried: ...
5
13394
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able to get a Boolean value TRUE or FALSE when a checkBox is selected. When the checkBoxList was out of the DataList i used "OnSelectedIndexChanged" and it was returning what i wanted but if its in a
4
2827
by: oshiko | last post by:
Hi All, Below is my SQL Statement, Select Text, Value, Status from Tables I want to mark as a checked when the Status is true, how do I achieve this during databinding? Thank you very much.
2
6256
by: Bart Van Hemelen | last post by:
The situation: I have a CheckBoxList cblTest, the items are disabled in cblTest_DataBound in a foreach (ListItem oItem in cblTest.Items) loop. I provide a link that calls a client-side JavaScript that enables the items -- this works perfectly. However, when I then click a LinkButton that does a postback and I loop through the items on serverside to pick up the selected ones, it doesn't pick them up. IMHO it seems to loop though the items...
0
2179
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
2418
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
3525
by: avital | last post by:
Hi, Hope someone can please help. I have a Gridview with a checkboxlist. On edititemTemplate I want the checkboxlist items to be selected as returned from the database. In the database I have a table called PrescriptionDetails with a field called Weekdays that can store data in the following format: Monday,Tuesday,Thursday,
0
2748
by: joebob8000 | last post by:
This seems like a simple task, but my 6 year old roots in classic ASP must be causing me trouble with my current problem. I am looking to provide a search for users in which they can select multiple categores (check boxes) and view only the results in those categories in a gridView control. My goal is to do so for movies, so an example would be if the user checks comedy and childrens then they would only get childrens comedies and the...
0
3520
by: mutt1170 | last post by:
I have a checkbox list nested inside a gridview. The gridview pulls its data from an objectdatasource and lists countries. The nested checkbox list is databound to another object datasource and lists the regions for each country. The checkboxlist has autopostback set to true and I want to perform an action based on whether or not each checkbox is selected. I am having trouble retrieving the nested checkboxlist to access the selected...
0
9703
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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
10548
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...
1
10295
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
9125
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
7604
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
6842
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
5500
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
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.