im new to asp.net. please help if u can.
is it possible to refer to a control(ie lable, placeholder, textbox)
that is inside a repeater object from a code behind file? when i place
the control object outside of the repeater, i can refer to it from the
code behind file. when i place the control object inside the repeater,
i get a 'need to instanciate the control object' error. if i declare
the control object inside the control behind file, the error goes
away, but i cant refer to the control objects components. please help. 9 10131
Hi, Ric,
The following article explains how it is done: http://msdn.microsoft.com/library/en...formspages.asp
Hope this helps
Martin
"Ric" <dj****************@yahoo.com> wrote in message
news:78**************************@posting.google.c om... im new to asp.net. please help if u can. is it possible to refer to a control(ie lable, placeholder, textbox) that is inside a repeater object from a code behind file? when i place the control object outside of the repeater, i can refer to it from the code behind file. when i place the control object inside the repeater, i get a 'need to instanciate the control object' error. if i declare the control object inside the control behind file, the error goes away, but i cant refer to the control objects components. please help.
thx martin. i really appreciate the help. i'll bookmark this site.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
thx again for the help martin. i was able to use your suggestion to
get to the control within the repeater. also, i was able to understand
a bit more bout objects, events and arguments. but, im sure i have a
lot to more to learn.
if u or someone else can help me with another question, please do.
i have a repeater pulling job information from a database. each
repeater itemtemplate has with a linkbutton and a row with a label
(for now).
<asp:repeater ID="EmployeeInfo" OnItemCommand="getActivityList"
runat="server">
<itemtemplate>
<tr bgcolor="#CCCCCC">
<td><%# Container.DataItem(0)%></td>
<td><%# Container.DataItem(1)%></td>
<td><%# Container.DataItem(2)%></td>
<td><%# Container.DataItem(3)%></td>
<td><%# Container.DataItem(4)%></td>
<td><asp:linkbutton Text=<%# Container.DataItem(5)%>
runat="server"/></td>
</tr>
<tr>
<td><asp:label id="litLabel" Runat="Server" Text="labelti"
Visible="false"/></td>
</tr>
</itemtemplate>
when u click on the linkbutton, the label(eventually it will be a
placeholder with more database info in another repeater) will become
visible with detailed info bout the job.
the first Container.DataItem(0) has an ID number that I need to
extract and send to the stored procedure. how can i extract that
dataItem. ive been able to loop throw the items in the repeater item
and extract the entire row. i tried to convert that info to a
DataBoundLiteralControl and pull the text from it. but when i tried to
use string functions to pull the ID number or even get a length of
string i could not consistently get what i needed. i figured out that
row is coded with <html> table and row tags. thus, im back to trying
to get the data from the first container.dataitem. so, to make a long
request even longer, what object or class do i use to pull individual
dataitems from an item. i looked at the dataitem property from
repeateritem class, but i cant get it to work. again, thx for the
help.
Hi, Ric,
You can pass this value in the CommandName or CommandArgument property: <asp:repeater ID="EmployeeInfo" OnItemCommand="getActivityList" runat="server">
<itemtemplate> <tr bgcolor="#CCCCCC"> <td><%# Container.DataItem(0)%></td> <td><%# Container.DataItem(1)%></td> <td><%# Container.DataItem(2)%></td> <td><%# Container.DataItem(3)%></td> <td><%# Container.DataItem(4)%></td> <td><asp:linkbutton Text='<%# Container.DataItem(5)%>'
CommandName="ShowDetails"
CommandArgument='<%# Container.DataItem(0)%>'
runat="server"/></td> </tr> <tr> <td><asp:label id="litLabel" Runat="Server" Text="labelti" Visible="false"/></td> </tr> </itemtemplate>
If the ID is an integer you will have to parse it:
[C#]
protected void getActivityList(object s, RepeaterCommandEventArgs e)
{
if(e.CommandName == "ShowDetails")
{
int ID = int.Parse(e.CommandArgument);
//....
}
}
[VB.NET]
Protected Sub getActivityList(s As Object, e As RepeaterCommandEventArgs)
If e.CommandName = "ShowDetails" Then
Dim ID As Int32 = Int32.Parse(e.CommandArgument)
'....
End If
End Sub
Hope this helps
Martin
thx again for the help martin. just curiously, if u had to send more
than one command arguement how would u do that? i used a commandName and
commandArgument and wondered what would u do to send two
commandArguments with one commandName or two commandNames each with a
commandArgument.
thx again for the push in the right direction.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi, ric carrasquilla,
<snip> just curiously, if u had to send more than one command arguement how would u do that?
You normally don't need to do that. The common design is to identify your
objects with a single identifier. It is possible to pass 2 parameters
anyway - one for the action and another for the object identifier. This is
how it was designed, this is how it works and I believe it is enough for any
case.
Greetings
Martin
thx again martin. i really appreciate the time and thoroughness of your
answers. have a good day.
ric
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I'd like to know which site helped to answer the question. I have a similar
issue. Can you provide the link?
TIA
"ric carrasquilla" <dj****************@yahoo.com> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...
thx martin. i really appreciate the help. i'll bookmark this site.
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
this is the link to how to find an object inside a repeater http://msdn.microsoft.com/library/de.../en-us/vbcon/h
tml/vbtskreferencingcontrolsinwebformspages.asp
i hope this helps. also, if u look at the thread, martin explains how
to send a commandname and command argument to the repeatercommandevent
please reply to this thread for more help.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jorge Ayala |
last post by:
Well I'm trying to catch and act upon a button event that is placed within
the item template of a repeater control. Yet the code I'm using isn't
working. What I've seen out there to explain how...
|
by: John Crowley |
last post by:
I'm having an odd problem with viewstate and a dynamically created control
inside a repeater template.
Basically, I have a repeater setup like this in the aspx:
|
by: John Holmes |
last post by:
I'm using data to rename some web controls on a form that uses a repeater
contol and so it can have mulitple instances of the same control set. The
controls get renamed (thanks to Steven Cheng's...
|
by: Dot net work |
last post by:
Hello.
I have an interesting data binding scenario:
I have a repeater control. It repeats a typical custom web user
control.
I also have a collection object, and each collection element...
|
by: WebMatrix |
last post by:
I am struggling with implementing somewhat complicated UI web-control. I
explored Repeater, but I am not sure if it's the best way to go. I am leaning
towards writing my own custom control and...
|
by: Mia Williams via .NET 247 |
last post by:
(Type your message here)
I have user control (listpanel control) and I ahve to display the search results inside the list panel user control.. how can I do that? Can i access the list panel control...
|
by: fernandezr |
last post by:
I would like to use a user control as a template inside a repeater.
Some of the fields in the control should be hidden depending on whether
or not there is data. I'm still a ASP .Net newbie so the...
|
by: Dave |
last post by:
I have the following ASP.NET 2.0 code (simplified here for ease):
<asp:Repeater id="SearchResultsRepeater" runat="server">
<ItemTemplate>
<uc:SearchResult ID="SearchResult"...
|
by: John Kotuby |
last post by:
Hi all,
I am using a Repeater in conjunction with a SQLDatasource and SQL Server.
One of the controls in the repeater is a HyperlLink as follows:
<asp:HyperLink...
|
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: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
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: 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: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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: 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...
| |