473,758 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Events with repeater items

I have a repeater that will have linkbuttons. I have googled much but
cannot find a solution to the following.

Since the items are dynamic I need to be able to attach handlers to the
linkbuttons to handle when they are clicked within server code. I can find
no examples of this.

Any examples?

Thanks
Lloyd Sheen

Jun 23 '07 #1
2 1701
On Jun 23, 9:52 pm, "Lloyd Sheen" <a...@b.cwrot e:
I have a repeater that will have linkbuttons. I have googled much but
cannot find a solution to the following.

Since the items are dynamic I need to be able to attach handlers to the
linkbuttons to handle when they are clicked within server code. I can find
no examples of this.

Any examples?

Thanks
Lloyd Sheen
Hi...

1. Add Link Button in ItemTemplate of reapeater
2. then add a commad name in the link attribute,.,,,
3. Subscribe the ItemDataBound to customize the items more
4. Subscribe the ItemCommand and then do code for link button
clicked...

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate >
<!--More data bound code will go here-->
<asp:LinkButt on ID="lnkSelect" Text="Select"
CommandName="Se lect" runat="server"> </asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
protected void Repeater1_ItemD ataBound(object sender,
RepeaterItemEve ntArgs e)
{
if (e.Item.ItemTyp e == ListItemType.Al ternatingItem ||
e.Item.ItemType == ListItemType.It em)
{
LinkButton btn = e.Item.FindCont rol("lnkSelect" ) as
LinkButton;
}
}

protected void Repeater1_ItemC ommand(object source,
RepeaterCommand EventArgs e)
{
if (e.CommandName == "Select")
{
//do code
}
}

Thanks
Masudur
http://munnacs.110mb.com


Jun 23 '07 #2

"Masudur" <mu*****@gmail. comwrote in message
news:11******** *************@n 60g2000hse.goog legroups.com...
On Jun 23, 9:52 pm, "Lloyd Sheen" <a...@b.cwrot e:
>I have a repeater that will have linkbuttons. I have googled much but
cannot find a solution to the following.

Since the items are dynamic I need to be able to attach handlers to the
linkbuttons to handle when they are clicked within server code. I can
find
no examples of this.

Any examples?

Thanks
Lloyd Sheen

Hi...

1. Add Link Button in ItemTemplate of reapeater
2. then add a commad name in the link attribute,.,,,
3. Subscribe the ItemDataBound to customize the items more
4. Subscribe the ItemCommand and then do code for link button
clicked...

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate >
<!--More data bound code will go here-->
<asp:LinkButt on ID="lnkSelect" Text="Select"
CommandName="Se lect" runat="server"> </asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
protected void Repeater1_ItemD ataBound(object sender,
RepeaterItemEve ntArgs e)
{
if (e.Item.ItemTyp e == ListItemType.Al ternatingItem ||
e.Item.ItemType == ListItemType.It em)
{
LinkButton btn = e.Item.FindCont rol("lnkSelect" ) as
LinkButton;
}
}

protected void Repeater1_ItemC ommand(object source,
RepeaterCommand EventArgs e)
{
if (e.CommandName == "Select")
{
//do code
}
}

Thanks
Masudur
http://munnacs.110mb.com

Thanks, exactly what I needed.

LS

Jun 23 '07 #3

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

Similar topics

0
2427
by: kamaumalone | last post by:
I have a dropdownlist which lives inside of a repeater. The repeater accepts user input via textboxes and the aforementioned dropdownlist. The repeater accepts phone numbers and allows for an arbitrary number of empty rows to be added to it. So, if a user knew in advance that they wanted to add 3 phone numbers, they can type the nuber '3' in a textbox (outside the repeater) and click a button (also outside of a repeater), and 3 new empty ...
1
9806
by: Mark Fox | last post by:
Hello, I have a repeater and in each itemtemplate I have a radiobuttonlist. I am attempting to figure out how on postback I could iterate through the rows displayed by the repeater and for each row grab the selected value of the radio button list. When is the Repeater.Items collection populated? I first attempted to access the Repeater.Items collection from the Command event of a normal linkbutton on the page, but it was empty. Is...
1
2327
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has disapeared. The read is done on a button click. I can read the selected items from the other controls in the repeater, demo page here
2
1597
by: Mark | last post by:
I am trying to use a Pagable Repeater with checkboxes in ASP.Net, I cannot seem to associate the checkbox with a particular database record so I lose the checked state from page-to-page. Below is a sample 1-page ASP.Net apllication built to run against the SQL pubs database. There are contents of 2 files 1. ASPX, 2. ASPX.VB If there is anyway you can help, I'd really appreciate it.
3
3318
by: Guoqi Zheng | last post by:
Sir, According to our design, very often, I need to have a different html code for the last row of our repeater control. I can not put those code difference into footer because those code has to be in the last data row. How can I edit the last data row of a repeater control?? -- Kind regards
7
5487
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the Repeater control, I've placed DropDownLists and CheckBoxes. When the user has updated the information, he/he clicks the submit button which is outside the scope of the Repeater control.
2
5522
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox and subcategory check boxes and click on submit button , I have to retrieve the corresponding categoryid and subcategory id, so that I can store it to a table. I am getting the categoryid but I am failing to get subcategoryid(actually I don't know...
4
4571
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). But... and this is the crappy part, the nested repeater's events are fired twice. How do I know this? I setup global private counter variables that get incremented on the repeater's ItemDataBound event. The outer repeater is correct and only...
1
7355
by: champ.supernova | last post by:
Hi, I have a dropdownlist which is repeated inside a repeater. What I'm wanting is for when one instance of the dropdownlist has its selection changed, for 1) this to trigger an 'OnSelectedIndexChanged' subroutine, and 2) for that subroutine to be able to somehow identify which 'row' of the repeater the dropdownlist belongs to. To keep things simple, I'm posting just the relevant parts of the code below...
0
9492
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
9885
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
9740
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
8744
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
7287
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
6564
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
3832
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
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2702
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.