Hi,
I wish to create a repeater control in c#.net that allows for the
selection of rows, any idea how this can be done.
Regards
Robert 5 4081
On May 30, 10:23*am, Robert Smith
<RobertSm...@discussions.microsoft.comwrote:
Hi,
* * *I wish to create a repeater control in c#.net that allows for the
selection of rows, any idea how this can be done.
Regards
Robert
why you want to use a repeater and not a grid for example?
what you mean with selection, you can use a checkbox column and when
checked you change the Css of the row, this is an indication of
"selection"
Hi Ignacio,
I wish to use a repeater because it is lighter than a gridview
and my supervisor recommended it.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
On May 30, 10:23 am, Robert Smith
<RobertSm...@discussions.microsoft.comwrote:
Hi,
I wish to create a repeater control in c#.net that allows for the
selection of rows, any idea how this can be done.
Regards
Robert
why you want to use a repeater and not a grid for example?
what you mean with selection, you can use a checkbox column and when
checked you change the Css of the row, this is an indication of
"selection"
A Gridview isn't always "lighter" or heavier that a Repeater; it depends
what you have in the control, how many rows and columns, and how many child
controls. Besides Gridview already has all the stuff you need, and since
your supervisor is asking you to reinvent the wheel by using a Repeater,
there's a pretty good chance he / /she is a real moron.
Peter
"Robert Smith" <Ro*********@discussions.microsoft.comwrote in message
news:7C**********************************@microsof t.com...
Hi Ignacio,
I wish to use a repeater because it is lighter than a gridview
and my supervisor recommended it.
"Ignacio Machin ( .NET/ C# MVP )" wrote:
>On May 30, 10:23 am, Robert Smith <RobertSm...@discussions.microsoft.comwrote:
Hi,
I wish to create a repeater control in c#.net that allows for the
selection of rows, any idea how this can be done.
Regards
Robert
why you want to use a repeater and not a grid for example?
what you mean with selection, you can use a checkbox column and when checked you change the Css of the row, this is an indication of "selection"
Hi,
I have a repeater control which is selectable, meaning that the selected row changes style on selection.
<asp:Repeater ID="repeaterList" runat="server" OnItemCommand="repeaterList_ItemCommand" OnItemDataBound="repeaterList_ItemDataBound">
<HeaderTemplate>
<table title="tableList" id="tableList" width="600px" style="font-size:small; font-family:Arial; border-style:solid; border-width:1px">
<tr style="background-color:#5D7B9D;color:White">
<th>Bill ID</th>
<th>Customer Name</th>
<th>Bill Number</th>
<th>Bill Date</th>
<th>Bill Total</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr title="trListRow" id="trListRow" class="tmpClass"
style="background-color:#F7F6F3; color:#333333"
onmouseover="javascript:setMouseOverColor(this);"
onmouseout="javascript:setMouseOutColor(this);"
onclick="javascript:setMouseClicked(this, <%# Container.ItemIndex %>);">
<td id="tdBillID"><%#DataBinder.Eval(Container.DataIte m, "BillID")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "CustomerName")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillNumber")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillDate")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillTotal") %></td>
<%--<td><asp:Button ID="click" Runat="server" CommandName="click" CommandArgument=<%# Container.ItemIndex %>></asp:Button></td>--%>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr id="trListRow" style="background-color:#FFFFFF; color:#284775"
onmouseover="javascript:setMouseOverColor(this);"
onmouseout="javascript:setMouseOutColor(this);"
onclick="javascript:setMouseClicked(this, <%# Container.ItemIndex %>);">
<td id="tdBillID"><%#DataBinder.Eval(Container.DataIte m, "BillID")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "CustomerName")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillNumber")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillDate")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "BillTotal") %></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
and the Javascript functions changing style:
function setMouseOverColor(element)
{
oldgridSelectedColor = element.style.backgroundColor;
element.style.backgroundColor='#DEECEF';
element.style.cursor='hand';
}
function setMouseOutColor(element)
{
element.style.backgroundColor = oldgridSelectedColor;
element.style.textDecoration = 'none';
}
function setMouseClicked(element, index)
{
ResetTheTable(index);
oldgridSelectedColor = "#DEECEF";
}
function ResetTheTable(index)
{
var vTable = document.getElementById("tableList");
var vRows = vTable.getElementsByTagName("tr");
// we start from 1 because 0 is the header
for(i = 1; i < vRows.length; i++){
if(i%2)
{
vRows[i].style.backgroundColor = '#F7F6F3';
vRows[i].style.color = '#333333';
vRows[i].style.fontWeight = 'normal';
}
else
{
vRows[i].style.backgroundColor = '#FFFFFF';
vRows[i].style.color = '#284775';
vRows[i].style.fontWeight = 'normal';
}
}
vRows[index+1].style.backgroundColor = '#DEECEF';
vRows[index+1].style.color = '#333333';
vRows[index+1].style.fontWeight = 'bold';
}
This works very nicely, changing the style of the row when a row is selected.
What I would like help with is I don't know how to store th index of the selected row so I can later access it from my C# code. I am pretty new to ASP development, I tried storing the selection in <inputand <asp:Labelvariables but the values don't seem to be visible from the C# side.
Any help would be appreciated.
Thanks,
Blanka
Sorry, the declaration of the asp:Repeater got a bit trimmed on the last post. Basically in each TR I assign javascript functions for the onmouseover, onmouseout, onclick events (the stuff that didn't get trimmed). The reason there are 2 blocks of event assignments is that I use and ItemTemplate and an AlternatingItemTemplate in the repeater.
Sorry if I'm not very clear.
Thanks,
Blanka This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ShijuFrancis |
last post by:
Hi All,
I have got a tricky situation out here...
I have got a repeater control in which one column is dropdown list control.
Say for instacnce I have got the values A,B,C,D in the drop down and...
|
by: Scott Lyon |
last post by:
I am having a strange problem. The program is a bit complex, but I'll try to
simplify what I can. I apologize if this is complicated, but I think this
would still be simpler than posting a bunch of...
|
by: Jeff |
last post by:
After I bind the repeater control in the form_load event, it builds
multiple lines based on the number of rows in the dataset.
In the repeater control, I have a textbox and a dropdown list box. ...
|
by: MattB |
last post by:
This is just a rephrased version of a question I posted earlier. I think I'm
closer now, so it seemed worthy of a new (more specific) post.
In my repeater I'm dynamically creating text boxes, so...
|
by: Ravi |
last post by:
Hi,
I have a radio button list and a dropdownlist inside a repeater
control.
Want to hide or display the dropdownlist based on selection in
radiobuttonlist.
I can add the...
|
by: Christoph Boget |
last post by:
Could someone point me to a resource that discusses how to
set up other controls (input box, checkbox, drop down list), etc
to be used in a Repeater? I'm not having a problem displaying
text in...
|
by: dinesh |
last post by:
After a selection a selection is made, the form posts to the server, but no
data gets displayed in the repeater. no errors are given.
<form id="Form1" runat="server">
Category:...
|
by: Christiaan Nieuwlaat |
last post by:
Hi everyone,
Could you please help me with this?
I need to create a table in which resultdata from a sql server table can be
shown and/or edited by using controls, for instance the radiobutton....
|
by: RichardH |
last post by:
Hi,
I have x number of table rows that all should have a checkbox and a
dropdownlist on each row. The checkbox could be checked and the dropdown
should contain y number of values that are...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |