Link to home
Start Free TrialLog in
Avatar of CharlieDev
CharlieDevFlag for United Kingdom of Great Britain and Northern Ireland

asked on

c#,asp.net-passing data to a control

Hi,
I am trying to pass data to a control from an aspx page.
On the aspx page I have:

<div class="polaroid01">
      <HatPhotoControl:HatPic HatID='<%# GetRandomImageURL()%>' runat="server" />
</div>

GetRandomImageURL returns a guid for the HatID

The control page has:

 private Guid HatID;

    public string hatID
    {
        get { return HatID.ToString(); }
        set { HatID = new Guid(value); }
    }


But the guid isnt being transfered

Anyone see why?
Thanks
Avatar of HarryNS
HarryNS

Can you check whether GUID is assigned when the aspx page calls GetRandomImageURL() method?

Hardcode a server side property/variable value and check whether it is working from aspx page or not.
Avatar of CharlieDev

ASKER

I can see that the hatID in the aspx page is being assigned the correct guid! It wont transfer over to the control though!
based on what you posted, I see case sensativity issue, try

<HatPhotoControl:HatPic hatID='<%# GetRandomImageURL()%>' runat="server" />
hatID starts lower case as the public property
ASKER CERTIFIED SOLUTION
Avatar of wht1986
wht1986
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks