Quantcast
Channel: Posting data from Drop down list box on ASCX to ASPX
Viewing all articles
Browse latest Browse all 2

Posting data from Drop down list box on ASCX to ASPX

0
0

I'm trying to post data from a dropdown list box on an ascx page to an aspx page and am have problems. One how do I drive the event. Two how do I get the data there. My current approach is not working.

on the ascx page I have a property defined as such:

        private string mySystemName;
        public string SystemName
        {
            get { return mySystemName; }
            set { mySystemName = value; }
        }

Then in the SelectedIndexChanged event I have the following code:

        protected void DropDownListSystem_SelectedIndexChanged(object sender, EventArgs e)
        {
            getLog();
            mySystemName = DropDownListSystem.SelectedValue;
        }

Now here is where I'm running into the problem. I don't know where in the aspx page to put code to pick up these changes or how even to know these events have occurred. I've been exerimenting by putting them in my Load event for the tab, which should pic them up when you click on a tab but this isn't really what I want and it's not working any way. It doesn't recognize the property on the ascx page.  Here's my current code from my aspx page which is in error:

        protected void mainTabStrip_Load(object sender, EventArgs e)
        {
            UserControl Adminlog = new AdminLogUserControl();
            string sysName = Adminlog.SystemName;
        }

It says UserControl does not contain a definition for SystemName. 

I tried Not defining a new UserControl from the existing one, but then it says that I'm trying to access a static property from a non static function... So if it sees it, I can't access it. Otherwise it doesn't see it.

So two problems:

  1. How do I correctly access the property
  2. Where can I drive the dropdown list selectedIndexChange event into my aspx page

Thanks for any help anyone can provide.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images