Solved

Syntax question II

Posted on 2016-09-22
2
34 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Scheduled IIS .Net2 AppPools recycle and SQL connection Hangs 33 86
How do I get the id from URL? 19 53
Syntax error 9 45
Anyway to make "All" the default in the dropdown? 6 33
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

943 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

10 Experts available now in Live!

Get 1:1 Help Now