Newbie: switch control

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I try to create a switch control, but I'm hitting a problem, changing the
switch value with button in the page (below failig test code).

I know in this test case I could create an extra variable and use it, my
problem is the switch, i my real problem is in a repeater, hence I cannot
use a property!

how to change the label of the galador:Switch?
-----------------------------
<script runat="server">
void OnSwapSwitch(object sender, EventArgs e)
{
switch (mySwitch.Value)
{
case "0":
mySwitch.Value = "1";
break;
default:
mySwitch.Value = "0";
break;
}
}
</script>

<galador:Switch id=mySwitch runat=server Value=1 >

<galador:SwitchCase runat=server label=0>
Azerty
<asp:LinkButton ID="LinkButton1" Runat=server
OnClick=OnSwapSwitch >Clic
Clac</asp:LinkButton>
</galador:SwitchCase>

<galador:SwitchCase runat=server label=1>
Qwerty
<asp:LinkButton ID="LinkButton2" Runat=server
OnClick=OnSwapSwitch >Kodak</asp:LinkButton>
</galador:SwitchCase>

</galador:Switch>
 
Have you tried to databind your value to some variable? For example, when
you switch, in your back-end code, if you set some variable ( string MyVar =
"";), then do a Page.DataBind(), then you can access it in your ascx/aspx
code using something like this... <galador:SwitchCase runat=server
label="<%= MyVar %>">

Would that work for you?
 
well, I guess I will have too....
but what I wonder is, my switch is in a repeater, how could I store the
value in a variable?
 
Back
Top