Dinamically changing "LinkButton" control style!

  • Thread starter Thread starter Jensen bredal
  • Start date Start date
J

Jensen bredal

I'am trying to change the style of my LinkButton
control .
I have a set of five control and i need to hilight the selected one. I want
to achive this
by setting MyLinkButton.CssClass="newStyle"
whenever "Mybutton_Click" is fired.

I have set MyLinkButton.CssClass="OldStyle"

in the code behind.

The buttons never get "newStyle. What i am doig wrong?

Thanks In Advance

J.B
 
In the codebehind, are you setting MyLinkButton.CssClass in the
Page_Load procedure?

If so, make sure that the MyLinkButton.CssClass is set like so:

Sub Page_Load()
If Not Page.IsPostBack
MyLinkButton.CssClass="OldStyle"
End If
End Sub

The first time the page loads, it will use oldstyle, and when a button
is clicked and MyButton_Click is fired, it ignore code above as a
postback has occurred.

Regards,
matt
 
Right, that is exactly what i'm doing.
The thing is that fro some reason, the code
lways goes through:
(IsPostback=false )
{
}

It seems like a LinkButton click does not cause (IsPosback=true)

I look up the IsPostBack property but the msdn help
says so litle about when exactly it cause to be true.

I recall someone here said it was true when "data of a form was posted back
to the server."

Well i must say i'm very confused now
 
Back
Top