Solved

Syntax question II

Posted on 2016-09-22
2
57 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

630 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