473,378 Members | 1,419 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,378 software developers and data experts.

Checkbox in dataRepeater

I have dataRepeater with itemtemlate:
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_end") %></td>
<td align=center>
<asp:CheckBox Runat=server ID='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>'></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
This doesn't work. I can't dynamically set the ID of an ASP.NET CheckBox.
I don't know why, it would be much easier.

But by the book, I can handle the OnItemDataBound event and create the
checkbox dynamically, set the ID property, and insert the
control to the Repeater.

How can I do that? Can I pass the
DataBinder.Eval(Container.DataItem,"adv_ID") to the OnItemDataBound event? I
need this value because it represents the ID property of my checkBox
control.

Any example?

At the end, when user clicks button, I must read the clicked checkboxes.

Thank you,
Simon
Nov 18 '05 #1
3 5554
I'm not 100% sure what you are doing, so I can think of a couple solutions,
but the quickest would be to use a hidden field

<asp:checkbox id="add" runat="server" />
<input type="hidden" id="adv_id" runat="server" value='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>' />

you can then see if "add" is checked, and if so get the value from 'adv_id'

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"simon" <si*********@stud-moderna.si> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have dataRepeater with itemtemlate:
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_end") %></td>
<td align=center>
<asp:CheckBox Runat=server ID='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>'></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
This doesn't work. I can't dynamically set the ID of an ASP.NET CheckBox.
I don't know why, it would be much easier.

But by the book, I can handle the OnItemDataBound event and create the
checkbox dynamically, set the ID property, and insert the
control to the Repeater.

How can I do that? Can I pass the
DataBinder.Eval(Container.DataItem,"adv_ID") to the OnItemDataBound event? I need this value because it represents the ID property of my checkBox
control.

Any example?

At the end, when user clicks button, I must read the clicked checkboxes.

Thank you,
Simon

Nov 18 '05 #2
Hi,

I know for the hidden field. That is one way.

Do you have solution where you set the id of the checkbox dynamically?
Or any other solution?

Thank you,
Simon
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:es**************@TK2MSFTNGP15.phx.gbl...
I'm not 100% sure what you are doing, so I can think of a couple
solutions,
but the quickest would be to use a hidden field

<asp:checkbox id="add" runat="server" />
<input type="hidden" id="adv_id" runat="server" value='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>' />

you can then see if "add" is checked, and if so get the value from
'adv_id'

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"simon" <si*********@stud-moderna.si> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have dataRepeater with itemtemlate:
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_end") %></td>
<td align=center>
<asp:CheckBox Runat=server ID='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>'></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
This doesn't work. I can't dynamically set the ID of an ASP.NET CheckBox.
I don't know why, it would be much easier.

But by the book, I can handle the OnItemDataBound event and create the
checkbox dynamically, set the ID property, and insert the
control to the Repeater.

How can I do that? Can I pass the
DataBinder.Eval(Container.DataItem,"adv_ID") to the OnItemDataBound
event?

I
need this value because it represents the ID property of my checkBox
control.

Any example?

At the end, when user clicks button, I must read the clicked checkboxes.

Thank you,
Simon


Nov 18 '05 #3
Only using OnItemDataBound and creating it dynamically. It's a timing
issue. The controls are created before data is bound...but you need the id
to create the control, so you can't set the id via a bind...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"simon" <si*********@stud-moderna.si> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

I know for the hidden field. That is one way.

Do you have solution where you set the id of the checkbox dynamically?
Or any other solution?

Thank you,
Simon
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:es**************@TK2MSFTNGP15.phx.gbl...
I'm not 100% sure what you are doing, so I can think of a couple
solutions,
but the quickest would be to use a hidden field

<asp:checkbox id="add" runat="server" />
<input type="hidden" id="adv_id" runat="server" value='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>' />

you can then see if "add" is checked, and if so get the value from
'adv_id'

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"simon" <si*********@stud-moderna.si> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have dataRepeater with itemtemlate:
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"adv_end") %></td>
<td align=center>
<asp:CheckBox Runat=server ID='<%#
DataBinder.Eval(Container.DataItem,"adv_ID") %>'></asp:CheckBox>
</td>
</tr>
</ItemTemplate>
This doesn't work. I can't dynamically set the ID of an ASP.NET CheckBox. I don't know why, it would be much easier.

But by the book, I can handle the OnItemDataBound event and create the
checkbox dynamically, set the ID property, and insert the
control to the Repeater.

How can I do that? Can I pass the
DataBinder.Eval(Container.DataItem,"adv_ID") to the OnItemDataBound
event?

I
need this value because it represents the ID property of my checkBox
control.

Any example?

At the end, when user clicks button, I must read the clicked checkboxes.
Thank you,
Simon



Nov 18 '05 #4

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

Similar topics

3
by: Stephen | last post by:
Hi, I have a quick question. I am displaying all the orders that are active. I am making use of a datarepeater with checkboxes to display data and a submit button to insert into the database. ...
2
by: muhamad | last post by:
Hi, How can I use the DataRepeater in CSharp , this control exists in VB6 ,i never used it . I want to insert into the DataRepeater TextBoxs that will show all the time data from the database ....
3
by: | last post by:
Hi, NG! Is there any updated version (.Net) of the Datarepeater control or do I have to use the old (VS6.0) version? Thanks. pax
0
by: simon | last post by:
I have datarepeater with checkBox: <ItemTemplate> <tr> <td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td> <td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td> <td><%#...
1
by: jose | last post by:
when insert a checkbox in a datarepeater throw this error: Specified cast is not valid.
2
by: Neven Klofutar | last post by:
Hi, How can I bind ArrayList of my object to DataRepeater ? I have 2 classes: public class Movie { private String _Name = ""; private Double _Price = 0;
1
by: Chris Leffer | last post by:
Hi. I have a DataRepeater that is filled with the results of a query based on four criteria fields. If one of these criterias is informed, I don't need to display a certain column in my...
1
by: =?Utf-8?B?QW1qYWQ=?= | last post by:
Hi i have datarepeater in which i have textboxes, how to create txtCustID_TextChanged event in datarepeater like simple textbox its easy double click it and it create automatically the event but in...
2
by: Tony K | last post by:
I downloaded the new VB PowerPack 3.0 and began using the DataRepeater. I have 2 DateTimePickers, current and future. When I add a new item, to the datarepeater, I want to automatically add 1...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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

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.