Static_problem in asp.net page

I'm new to Resharper, and I have a question concerning a error in an ASP.NET page.  The page has a typical LinkButton with an ID, runat, CommandName, and OnCommand.  The OnCommand contains the name of a Shared method.  And ReSharper is showing a red bar on that line.  What should the OnCommand contain in order to not get cause an error?

<LinkButton ID="myID" runat="server" Text="HelloWorld"

CommandName

="SayHello    OnCommand = "btnWorld_Click" style="font-size: 130%; font-weight: bold; color: #0065ff" >

2 comments
Comment actions Permalink

Hello John,

In order to avoid this error the method in 'OnCommand' attribute should not
be Shared. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I'm new to Resharper, and I have a question concerning a error in an
ASP.NET page.  The page has a typical LinkButton with an ID, runat,
CommandName, and OnCommand.  The OnCommand contains the name of a
Shared method.  And ReSharper is showing a red bar on that line.  What
should the OnCommand contain in order to not get cause an error?

<LinkButton ID="myID" runat="server" Text="HelloWorld" CommandName

="SayHello    OnCommand = "btnWorld_Click" >

---
Original message URL:
http://devnet.jetbrains.net/message/5320322#5320322



0
Comment actions Permalink

OK, I understand that it wants the method to be an instance method, but I'm not sure what's wrong with a Shared/Static method.  I prefer to use Shared whenever the method doesn't need need state.  Is changing it to an instance method the only solution other than ignoring the message?

0

Please sign in to leave a comment.