473,729 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessign System.Web.UI.W ebControls.Repe ater in code

I have a Repeater control in an app I'm updating. I need to write
code (event method) when a user clicks on one of the columns in the
control. But there is no method like "Repeater_OnCli ck" or something
like that. Is there a way to get access to this control with an event
method of some kind?

If not, (and here's where my inexperience in web development will show
through), is there another server side grid type control that I could
switch to? I would prefer not to do this as there is a lot of other
code (in javascript, etc) that is tied to this control but if I have
no choice I'm not sure which is the best to use.

Jun 15 '07 #1
6 3759
On Jun 16, 12:21 am, Doogie <dnlwh...@dtgne t.comwrote:
I have a Repeater control in an app I'm updating. I need to write
code (event method) when a user clicks on one of the columns in the
control. But there is no method like "Repeater_OnCli ck" or something
like that. Is there a way to get access to this control with an event
method of some kind?

If not, (and here's where my inexperience in web development will show
through), is there another server side grid type control that I could
switch to? I would prefer not to do this as there is a lot of other
code (in javascript, etc) that is tied to this control but if I have
no choice I'm not sure which is the best to use.
hi...

I am not sure of exactly what problem you are referring ...
But if the problem is catching repeater's click event in server
side...
then try itemCommand event of reapeater... and use e.commandname
e.commandsource etc... to solve your problem

Thanks
Masudur


Jun 16 '07 #2
Hi Masudur,

I put some code in the itemCommand event for my repeater, put a
breakpoint on that code, clicked on the grid when I ran the app and
nothing happened. What action causes the itemCommand event to be
executed?

Jun 18 '07 #3
On Jun 18, 6:30 pm, Doogie <dnlwh...@dtgne t.comwrote:
Hi Masudur,

I put some code in the itemCommand event for my repeater, put a
breakpoint on that code, clicked on the grid when I ran the app and
nothing happened. What action causes the itemCommand event to be
executed?
I am not sure what is going on there...
here how it should go...

<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="S qlDataSource1" OnItemCommand=" Repeater1_ItemC ommand1">

you put some kind of button or link button .... in itemTemplate or
AlternetingItem Templete
for example

<ItemTemplate >
<div style="backgrou nd-color:#cccccc">
<asp:Button ID="btnSelect" Text="Select"
runat="server" CommandName="Se lect" />
<asp:Label ID="lblName" runat="server" Text=<%#
DataBinder.Eval (Container.Data Item, "Name") %>></asp:Label>
</div>
</ItemTemplate>

as you can see in commandName property of the button i put "Select" As
the command name after that in codebehind file

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

i think i didn't understand what the actual problem is ...
can you be a little bit more descriptive.

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

Jun 19 '07 #4
Well, the problem has kind of changed.

Here's an example of what my repeater looks like in html (this is a
partial example for space sake):

<asp:repeater ID="RptTrip" Runat="server" EnableViewState ="false">
<ItemTemplate >
<trip_detail_in fo trip_detail_id ='<%#
Container.DataI tem("trip_detai l_id")%>'
leg_start_dt = '<%#
Container.DataI tem("leg_start_ dt")%>' />
</ItemTemplate>
</asp:repeater>

This grid is tied to an xsl document. I would like to set this up so
that I can write a method in VB.NET to access the data in this
control. At this point, I don't need a Repeater control event
anymore, I have a button that I've created - outside of the control -
that will have code behind it to do the work I need.

But I need to know what the data is inside the control. The Repeater
control appears to have no properties/methods, etc of any kind that
will show me what data is inside of it as far as I can tell. So I
can't figure out how to "read my data".

I am thinking that somehow I need to read the xsl but am not sure
there either. At this point, I am not sure what the best approach is
to accomplish this.

Jun 19 '07 #5
On Jun 19, 9:20 pm, Doogie <dnlwh...@dtgne t.comwrote:
Well, the problem has kind of changed.

Here's an example of what my repeater looks like in html (this is a
partial example for space sake):

<asp:repeater ID="RptTrip" Runat="server" EnableViewState ="false">
<ItemTemplate >
<trip_detail_in fo trip_detail_id ='<%#
Container.DataI tem("trip_detai l_id")%>'
leg_start_dt = '<%#
Container.DataI tem("leg_start_ dt")%>' />
</ItemTemplate>
</asp:repeater>

This grid is tied to an xsl document. I would like to set this up so
that I can write a method in VB.NET to access the data in this
control. At this point, I don't need a Repeater control event
anymore, I have a button that I've created - outside of the control -
that will have code behind it to do the work I need.

But I need to know what the data is inside the control. The Repeater
control appears to have no properties/methods, etc of any kind that
will show me what data is inside of it as far as I can tell. So I
can't figure out how to "read my data".

I am thinking that somehow I need to read the xsl but am not sure
there either. At this point, I am not sure what the best approach is
to accomplish this.
hi...
First can you please make sure that your View state persists... by
enableViewState = true...

foreach(Repeate rItem item in Repeater1.Items )
{
if (item.ItemType == ListItemType.Al ternatingItem ||
item.ItemType == ListItemType.It em)
{
Label lbl = (Label)item.Fin dControl("lblNa me");
if (lbl != null)
{
string Name = lbl.Text.Trim() ;
}
}
}

Thanks

Masudur
www.kaz.com.bd
http://munnacs.110mb.com

Jun 20 '07 #6
Hi Masudur,
I found a way around my issue. It wasn't exactly what I planned on
doing, I stored the data I needed to access from the repeater grid
inside a hidden control and used that to do what I need. Since I
won't ever be using much data at any given time, this seems to work
well (and gets me around a problem that has been taking days to figure
out!)
Jun 20 '07 #7

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

Similar topics

0
2246
by: Eric Diana | last post by:
I am trying to place an strings into an array of strings I am declaring as Dim Fields() As String I have another variable im doing the same thing with and it works. Public Shared Operations() As String This is the error I am getting
2
1941
by: Shannon | last post by:
I am having a very strange issue with my asp.net application. I have created a datagrid which dynamically gets populated from a person choosing a value from a dropdown list and entering a quantity into a text box (a simple version of a shopping cart). When I run/debug the web page using the localhost in the page URL (http://localhost/mypage.aspx), the datagrid updates properly when a command button is clicked and all is well. However,...
0
9776
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
1
5583
by: Zenobia | last post by:
How do I bind an array, arrayList or even a stack to a repeater containing hyperlinks. The data structure (array, arrayList or even a stack) has dates in ISO format "YYYY-MM-DD". The repeated hyperlinks will be displayed, for example, in this form: <a href='default.aspx?arc=2004-06-29'>2004-06-29</a> or, better:
3
5691
by: Luis Esteban Valencia | last post by:
A page let of work for me I commented almost all lines but nothing the code is this
3
4149
by: Patrick.O.Ige | last post by:
I'm loading an Array below but getting the error "Object reference not set to an instance saying 'ItemNumber = CType(Args.Item.FindControl("ItemNumber"), TextBox).Text' is the error line. I DON'T KNOW WHAT I'M DOING WRONG I USED ASP.NETWebMatrix and its working well!! Any help!! I have declared ItemNumber as u can see below " :-
2
2630
by: Robert | last post by:
Hi, if I create a class A with some properies, then create classes B and C derived from A, later create and ArrayList filled with some B and C items. This list I would like to use as a datasource for a repeater control. Is it possible to add more than one <ItemTemplate>? I would like to have i.e two templates, one for B and second for C object. I'm using ASP.NET (2.0) very shortly, but I haven't discovered much about...
1
2805
by: thithi | last post by:
Please help me " System.Data.SqlClient.SqlException: Prepared statement '(@Name varchar(100),@Describes varchar(100),@Money char(10))Upda' expects parameter @Describes, which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Assignment.rose.dtgFlower_UpdateCommand(Object source,...
1
4762
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF THE PROGRAM PLEASE HELP ME Server Error in '/WebApplication1' Application. -------------------------------------------------------------------------------- Input string was not in a correct format. Description: An unhandled exception occurred...
0
8917
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...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9200
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
9142
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
8148
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
6722
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
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
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
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.