problem accessing row in repeater!

J

Jeff

Hey

asp.net 2.0

I have a Repeater control consisting of linkbuttons on my webpage. when a
linkbutton is clicked I need to get the info about the linkbutton clicked
and put that info in a session variable so it can be accessed from another
webpage in the same application (the webpage opened by the linkbutton)

I tryed using this script, but it gives me compile error: wrong parameter
protected void rptOnline_OnItemCommand(RepeaterCommandEventArgs e)
{
}

<asp:Repeater ID="rptOnline" runat="server"
OnItemCommand="rptOnline_ItemDataBound" >

But I get error telling that this
"rptOnline_OnItemCommand(RepeaterCommandEventArgs e)" method don't contain
the correct parameters, but I copied it from the documentation....

Maybe there is a better way to do this? I've used a PostBackValue on another
project. But I don't know how to use PostBackValue to this one, because I
haven't found the PostBackValue property in the LinkButton class...

Any suggestions?

Best Regards!

Jeff
 
B

Bruno Alexandre

dont use that!

<asp:repeater ...

<content>
<asp:linkButton id="myLnkButton" Text='<%# Eval("myName") %>'
CommandName='<%# Eval("myName") %>' onCommand="submitLink()" />
</content>

</asp:repeater>


Protected Sub submitLink(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
Dim linkName as STring = e.CommandName.ToString
' do whatever you want with the link name now :)
End Sub


--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
 
B

bruce barker \(sqlwork.com\)

you are confusing the OnItemComand event delegate with the OnItemCommand
method. you want to use the delegate (event handler) version. the method
signature you used is when your code inherit from the repeater and want to
change the behavior.

to catch the event use::

protected void rptOnline_OnItemCommand(Object sender,
RepeaterCommandEventArgs e)
{
}

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top