Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Syntax question II

Posted on 2016-09-22
2
Medium Priority
?
71 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 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

927 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