Solved

Syntax question II

Posted on 2016-09-22
2
30 Views
Last Modified: 2016-09-22
With EEs help, I have the code like this

    protected void MoveAllbtn_Click(object sender, EventArgs e)
    {
       

        Button button = (Button)sender;
        string buttonId = button.ID;

        foreach (var item in listBox1.Items.Cast<ListItem>().Reverse())
        {
            //somthing here
        }

        System.Web.UI.AttributeCollection attributColl = (System.Web.UI.AttributeCollection)MoveAllbtn.Attributes;
        if (attributColl != null && attributColl.Count > 0 && attributColl["CustomParameter"] != null)
        {
            string myCustomParameterValue = attributColl["CustomParameter"];
            testBox.Text = myCustomParameterValue;
        }


        
        

        testBox.Text = buttonId;
    }

Open in new window



I was wondering if there is a way to replace MoveAllbtn (the ID of the button) dynamically. So, buttonId  can be in the code...thanks



System.Web.UI.AttributeCollection attributColl = (System.Web.UI.AttributeCollection)MoveAllbtn.Attributes;
0
Comment
Question by:mcrmg
2 Comments
 
LVL 21

Accepted Solution

by:
Randy Poole earned 500 total points
ID: 41811366
System.Web.UI.AttributeCollection attributColl = (System.Web.UI.AttributeCollection)button.Attributes;

Open in new window

0
 

Author Closing Comment

by:mcrmg
ID: 41811453
thank you
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now