We help IT Professionals succeed at work.

VS2010 warning help

457 Views
Last Modified: 2013-11-13
Getting the warning in my code and not sure how to clean it up properly.
Warning	2	WithEvents variable 'UniqueID' conflicts with property 'UniqueID' in the base class 'Control' and should be declared 'Shadows'.	

Open in new window


This came in shortly after I added
<asp:HiddenField id="UniqueID" runat="server" value=""/> in my default page, and
 If Not IsPostBack = True Then
            Dim GuidString As String = Guid.NewGuid.ToString
            Session("HiddenKeyString") = GuidString
            UniqueID.Value = GuidString
        End If

Open in new window

in my code behind.  I've used this in another project without any additional steps, so I'm unsure why it's causing an issue now.
Comment
Watch Question

You should change the name because UniqueID is a property for the Control Class in ASP.NET.
Paul JacksonSoftware Engineer
CERTIFIED EXPERT
Top Expert 2011

Commented:
That's because the control class which is derived by hiddenfield already has a property called uniqueid. Change the id of your hidden field to something else and it will be fine.
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
Consider me a beginner... what do you mean it's a property for the control class?  Have I duplicated something that's embedded natively?
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Paul JacksonSoftware Engineer
CERTIFIED EXPERT
Top Expert 2011
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2007

Author

Commented:
And so it did - thanks for the quick help.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.