3 8570
Try something like this. In your page, you have a repeater...
<asp:Repeater id="HomesRepeater" runat="server">
<ItemTemplate>
<tr>
<td class="HomesItem" colspan="2" valign="middle">
<asp:LinkButton ID="linkHomeItem" Runat="server"
OnCommand="LinkButtonClick"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "MlsNumber")
%>'
CommandName='<%# DataBinder.Eval(Container.DataItem, "CoagentID_NE")
%>'>
<%# DataBinder.Eval(Container.DataItem, "Address") %>,
<%# DataBinder.Eval(Container.DataItem, "City") %>,
<%# DataBinder.Eval(Container.DataItem, "State") %>
<%# DataBinder.Eval(Container.DataItem, "Zip") %>
</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
... if you have one...
</AlternatingItemTemplate>
</asp:Repeater>
Then in your codebehind file do this...
protected void LinkButtonClick(Object sender, CommandEventArgs e){
// do something here
}
--
Alex Mueller
I'm using a custom template so the ItemTemplate is not in the html
on the webform.
e.g.
<form id="Form1" method="post" runat="server">
<asp:Repeater id="Repeater1" runat="server"></asp:Repeater>
</form>
I have to run - but I'll get an example with the northwind database
going so I can post it to you....
"Alex" wrote: Try something like this. In your page, you have a repeater...
<asp:Repeater id="HomesRepeater" runat="server"> <ItemTemplate> <tr> <td class="HomesItem" colspan="2" valign="middle"> <asp:LinkButton ID="linkHomeItem" Runat="server" OnCommand="LinkButtonClick" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "MlsNumber") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "CoagentID_NE") %>'> <%# DataBinder.Eval(Container.DataItem, "Address") %>, <%# DataBinder.Eval(Container.DataItem, "City") %>, <%# DataBinder.Eval(Container.DataItem, "State") %> <%# DataBinder.Eval(Container.DataItem, "Zip") %> </asp:LinkButton> </td> </tr> </ItemTemplate> <AlternatingItemTemplate> ... if you have one... </AlternatingItemTemplate> </asp:Repeater>
Then in your codebehind file do this...
protected void LinkButtonClick(Object sender, CommandEventArgs e){ // do something here }
-- Alex Mueller
works like a charm alex!
"Alex" wrote: Try something like this. In your page, you have a repeater...
<asp:Repeater id="HomesRepeater" runat="server"> <ItemTemplate> <tr> <td class="HomesItem" colspan="2" valign="middle"> <asp:LinkButton ID="linkHomeItem" Runat="server" OnCommand="LinkButtonClick" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "MlsNumber") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "CoagentID_NE") %>'> <%# DataBinder.Eval(Container.DataItem, "Address") %>, <%# DataBinder.Eval(Container.DataItem, "City") %>, <%# DataBinder.Eval(Container.DataItem, "State") %> <%# DataBinder.Eval(Container.DataItem, "Zip") %> </asp:LinkButton> </td> </tr> </ItemTemplate> <AlternatingItemTemplate> ... if you have one... </AlternatingItemTemplate> </asp:Repeater>
Then in your codebehind file do this...
protected void LinkButtonClick(Object sender, CommandEventArgs e){ // do something here }
-- Alex Mueller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Keith Harris |
last post by:
Hi,
I have a Repeater control which is bound to a dataset. In the footer of the
repeater control, I have a Button whose visibility I want to vary according
to the sum of a column being > 0.
...
|
by: pnr |
last post by:
I have an repeater that contains data witch it schould be possible to
delete, I have placed a delete button in each row, but i can't make
it work :-(
This is my repeater (just a little bit of...
|
by: Keith Harris |
last post by:
Hi,
I have a Repeater control which is bound to a dataset. In the footer of the
repeater control, I have a Button whose visibility I want to vary according
to the sum of a column being > 0.
...
|
by: Mauritsius |
last post by:
I have a simple page where I would like to modify a repeater (bounded
to a dataset) if a button (outside the repeater) is clicked or not.
I tried to solve this with a button click event that...
|
by: Shimon Sim |
last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as
onclick="btnSort_Click".
Made btnSort_Click method public. It doesn't fire if I click on it. I tried
to attach it in...
|
by: mosscliffe |
last post by:
I am sorry but I am all very new and slow at understanding all this
ASP.NET2.
I found some code which showed how to page with a repeater. All very
excited as I had been looking for this all...
|
by: koonda |
last post by:
Hi Guys,
I have 5 listbox controls which I populated from the database tables. I tried it using the wizard. For all 5 listboxes and a single Repeater I used a SQL DataSourse Object and mapped this...
|
by: Queez |
last post by:
I have an issue with an ASP repeater which is seriously frustrating me.
In simple terms, I have an ASP repeater which is meant to display a list of items for a wedding list, including the name of...
|
by: Nathan Sokalski |
last post by:
I have a Button that uses the PostBackUrl property which is inside a
Repeater template. When I get to the Page that is being posted to (the one
specified in PostBackUrl), I am having trouble...
|
by: semomaniz |
last post by:
I have a button inside a repeater which is supposed to open a popup when clicked. But when i click on the button my modalpopup does not open. The strange thing is on the code provided below if i...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| |