Solved

VS2010 warning help

Posted on 2013-11-13
6
439 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.
0
Comment
Question by:sirbounty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 10

Expert Comment

by:joriszwaenepoel
ID: 39644660
You should change the name because UniqueID is a property for the Control Class in ASP.NET.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39644676
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.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 39644698
Consider me a beginner... what do you mean it's a property for the control class?  Have I duplicated something that's embedded natively?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
joriszwaenepoel earned 125 total points
ID: 39644714
Exactly.

The ASP.NET Page class is a derived class from the Control class, and UniqueID is a property of the Control class.  That means that that property also exists on the Page class.

You added a control to the page, and named it UniqueID also.  Now there is a naming conflict.  

If you give your control a new name, the warning will disappear.
0
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 125 total points
ID: 39644724
All asp.net controls are derived from the control class, the control class already has a property/attribute called UniqueId.

The control class defines the properties, methods and events shared by all asp.net server controls.

Control Class

UniqueId property of the Control Class
0
 
LVL 67

Author Closing Comment

by:sirbounty
ID: 39644764
And so it did - thanks for the quick help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question