Technical support This forum is closed.
Version 1.x > Technical support > User Control - more issues accessing values View modes: 
User avatar
Guest
norashlea - 5/14/2006 8:37:59 AM
   
User Control - more issues accessing values
Hi,

I've run into problems, again, getting the value from a control on a User Control. This time it's a dropdownlist.

To get the value I use:

if(Convert.ToInt32(this.ddlNetwork.SelectedIndex)!=0) {Convert.ToInt32(this.ddlNetwork.SelectedValue);}

When the dropdownlist is on a page template aspx registered in CMSDesk, and then a page created, all is ok.

When it is on a user control, if I drop the control onto a page test.aspx and then navigate to test.aspx (not registered as a page template), all is ok.

But, if I register the user control in CMS Desk, and then put it on a page created in CMS Desk, I can't read any value at all. SelectedIndex is always -1. But I can get the value from a radio button list!!!

Regards,
Sharon.

User avatar
Guest
norashlea - 5/16/2006 8:48:46 PM
   
Re: User Control - more issues accessing values
Can I ask about this problem again please?

I know that I could create a separate page template, where I don't have any problems getting the value of the ddl, but I really need to use a user-control that I can drop onto a virtual page created in CMS Desk.

If I can get the selected value of a radio button list on a user control, why can't I get the selected value of a dropdownlist?

Regards,
Sharon.


User avatar
Member
Member
Martin_Kentico - 5/24/2006 10:34:31 AM
   
Re: User Control - more issues accessing values
Hello,

If there is not SelectedIndex set, your Dropdownlist control probably does not have any items at the time you are trying to get the SelectedIndex, could you please check if this is true?

Where is your user control situated? Is it on the .aspx page template, or placed on the page through Editable Region content macro (like %%control:yourcontrol%%) ?

Best Regards