I created a user control for a button because I will be needing to use it multiple times in the application.
<td class = "center" colspan = "4"><uc:Instructions ID="Instructions" runat="server" />
I have this in the ascx file of the button
<asp:Button ID ="btnInstrs" Text ="Instructions" runat ="server" CssClass ="buttonGreen" OnClick ="btnInstrs_onClick"/>
This is the code behind for the user-control
protected void btnInstrs_onClick(object sender, EventArgs e)
{
}
public void setColorGreen()
{
btnInstrs.BackColor = System.Drawing.Color.Green;
}
I have this as the CSS
.buttonGreen
{
background-color: green;
}
So far I have this in the code behind in one of the pages I will be needing this button
Instructions.setColorGreen();
The setColorGreen method is changing the background color to green when I call it. Any idea why using just the CSS isn't doing the job?
Now to my main question.
I want to return some instructions as a popup and some text on the page when the button is clicked. to get those instructions I will need an itemID to look in the DB and get the instructions So if I was doing everything in the source page. In the event handler I would make a D.B call for the item ID and find the instructions and display but because I want to do it using the user control I don't know how to pass in the itemID or anything else as the parameter into the user control event handler.
Any advise as to how I could code the event handler so I can re-use it in different pages to get the instructions(for an itemID) would be greatly appreciated.