problem accessing row in repeater!

  • Thread starter Thread starter Jeff
  • Start date Start date
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
 
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/
 
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)
 
Back
Top