473,624 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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:CheckBoxLi stcontrol. Instead, I opted to use
an <asp:Repeaterco ntrol with an HTML <input type="checkbox"
runat="server"t ag inside the Repeater's <ItemTemplatese rver-side
element. Here's an snippet of my ASPX code:

=============== =============== =============== =========
<asp:Repeater runat="server" ID="StoredProce dureCheckboxLis t"
Visible="false" >
<HeaderTemplate >
<table border="0" cellpadding="0" cellspacing="3" width="100%">
</HeaderTemplate>
<ItemTemplate >
<tr>
<td style="width:30 px;"><input type="checkbox"
name="SelectedS toredProcedureI ds" value="<%#
DataBinder.Eval (Container.Data Item, "StoredProcedur eID") %>"
title="[<%# DataBinder.Eval (Container.Data Item, "StoredProcedur eID")
%>] <%# DataBinder.Eval (Container.Data Item, "StoredProcedur eName")
%>"></td>
<td><%# DataBinder.Eval (Container.Data Item,
"StoredProcedur eName") %></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:Repeaterco ntrol.

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 1723

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

Similar topics

5
3286
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> Clicking View will open a new browser and load PDFReader.aspx My client would like me to hide the address bar and toolbar on this new
0
1195
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 would in turn perform their own transform based on existing xml and xslt files. As another way of accomplishing my goal, I was thinking I could have a dataset tied to a repeater or table control that would write out the <asp:Xml> controls for...
3
2758
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 into a <xml> document but not sure which direction to take. Is there perhaps a starter document which uses sql server as the data source I can tap into.
0
1269
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 reference to the MasterPage with: Dim myPage As MasterPage myPage = CType(Me.Master, MasterPage) myPage.FinishMyStuff()
1
4887
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 I try to give the repeater values by removing if (!IsPostBack) {} from the
8
3019
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 way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
2
3875
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" /><br /> <label... <label... <label...
1
3431
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()" CommandArgument=reader.ToString() I'm not at all sure how to tackle this. I have page that contains embedded .ASCX. The buttons would be displayed within the embedded web user control.
3
2564
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
8234
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...
1
8335
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
8474
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
7158
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
6110
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
5563
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();...
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.