473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can CheckBoxList items be used in SelectParameters 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:CheckBoxList ID="cblTypes" runat="server" AutoPostBack="True"
RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="legend"
onselectedindexchanged="cblTypes_SelectedIndexChan ged">
<asp:ListItem Selected="True" Value="1">Type1</asp:ListItem>
<asp:ListItem Value="2">Type2</asp:ListItem>
<asp:ListItem Value="1">Type3</asp:ListItem>
</asp:CheckBoxList>

[...]

<asp:ObjectDataSource ID="odsElements" runat="server"
OldValuesParameterFormatString="{0}"
SelectMethod="GetElementsByUserId" TypeName="ElementsBLL">
<SelectParameters>
<asp:SessionParameter Name="userId" SessionField="UserId" Type="String" />
[...]
</SelectParameters>
</asp:ObjectDataSource>

The BLL's select method has the following signature:
public Elements.ElementDataTable ElementsBLL.GetElementsByUserId(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 2557
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:CheckBoxList ID="cblTypes" runat="server" AutoPostBack="True"
RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="legend"
onselectedindexchanged="cblTypes_SelectedIndexChan ged">
<asp:ListItem Selected="True" Value="1">Type1</asp:ListItem>
<asp:ListItem Value="2">Type2</asp:ListItem>
<asp:ListItem Value="1">Type3</asp:ListItem>
</asp:CheckBoxList>

[...]

<asp:ObjectDataSource ID="odsElements" runat="server"
OldValuesParameterFormatString="{0}"
SelectMethod="GetElementsByUserId" TypeName="ElementsBLL">
<SelectParameters>
<asp:SessionParameter Name="userId" SessionField="UserId" Type="String" />
[...]
</SelectParameters>
</asp:ObjectDataSource>

The BLL's select method has the following signature:
public Elements.ElementDataTable ElementsBLL.GetElementsByUserId(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
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....
5
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...
4
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...
2
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...
0
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...
0
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...
0
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...
0
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...

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.