473,399 Members | 3,401 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,399 software developers and data experts.

<asp:Repeater>, checkbox values and ASP.NET 2.0

A few weeks ago, I created a Classic ASP page that connects to a
machine with SQL Server installed on it, prompts the user to select a
database on that server, then lists all of user-created stored
procedures in that database. The user can select any of those stored
procedures by clicking on checkboxes; after submitting their
selections, a script to delete and then re-create each stored procedure
will be generated. Now I'm trying to do the same thing using ASP.NET.

I wanted to render the checkboxes inside an HTML table column, so I
avoided using the <asp:CheckBoxListcontrol. Instead, I opted to use
an <asp:Repeatercontrol with an HTML <input type="checkbox"
runat="server"tag inside the Repeater's <ItemTemplateserver-side
element. Here's an snippet of my ASPX code:

================================================== ====
<asp:Repeater runat="server" ID="StoredProcedureCheckboxList"
Visible="false">
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="3" width="100%">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width:30px;"><input type="checkbox"
name="SelectedStoredProcedureIds" value="<%#
DataBinder.Eval(Container.DataItem, "StoredProcedureID") %>"
title="[<%# DataBinder.Eval(Container.DataItem, "StoredProcedureID")
%>] <%# DataBinder.Eval(Container.DataItem, "StoredProcedureName")
%>"></td>
<td><%# DataBinder.Eval(Container.DataItem,
"StoredProcedureName") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table><br>
</FooterTemplate>
</asp:Repeater>
================================================== ====

The above ASPX code works, and I had no problem retrieving the selected
checkbox string values (via the Request.Form collection) after
postback. However, I also wanted all of the checkboxes the user
selected to remain selected after postback. And that's when I realized
that I didn't know how to get a reference (via C# code-behind page) to
the collection of checkboxes inside the <asp:Repeatercontrol.

I know I could probably use the page's ViewState to do this, but I
wanted to start simple. I've also posted a barebones version of my
project ( http://tinyurl.com/yztohf ), to help illustrate my problem:
the project is comprised of three small files (ASPX, CS & Web.config)
authored in Visual Studio .NET 2005. All you need to do is modify
Web.config so that the [MyDatabase] connection string points to your
database, and it should work just fine. Any advice or tips would be
greatly appreciated... thanks in advance!

-= Tek Boy =-

Nov 15 '06 #1
0 1710

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

Similar topics

5
by: George Durzi | last post by:
I currently have an href inside of an asp:repeater <a href='<%# String.Concat("PDFReader.aspx?id=", DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>' target="_blank">View</a> ...
0
by: Random | last post by:
I would like to be able to read an Xml file with an <asp:Xml> Web Control and using XSLT dynamically write <asp:Xml> Web Controls to the page using the information from the first Xml file, which...
3
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed...
0
by: Beatniks | last post by:
Is it possible to define a custom event for a contentplaceholder? I've got a chain of bubbling events: Button>repeater>childPage--- <ContentPlaceHolder> --- MasterPage In the childPage I get a...
1
by: Fred Dag | last post by:
As far as I can work out when using the OnTextChanged event I cannot get the TextBox and Labels values when the event fires as they are populated by a <asp:repeater and so don't have values. If...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
2
by: bissatch | last post by:
Hi, I am trying to output a list of checkboxes. Using ASP .NET controls, I was able to create the following: <label for="colour_red">Red: </label><asp:CheckBox ID="colour_red" runat="server"...
1
by: FredZimmerman | last post by:
How do I dynamically generate <ASP:buttoncontrols for a repeating recordset (using reader with while loop). Each row would have ASP:Button and CommandName="sameFunctionForAll()"...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
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,...
0
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...

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.