Link to home
Start Free TrialLog in
Avatar of mcrmg
mcrmg

asked on

Syntax question II

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;
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcrmg
mcrmg

ASKER

thank you