Page 158 - DCAP312_WEB_TECHNOLOGIES_II
P. 158
Web Technologies-II
Notes ViewState[ “currentColorIndex”] = currentColorIndex.ToString();
}
protected void buttonUp_Click(object sender, EventArgs e)
{
if(currentColorIndex == 0)
{
currentColorIndex = colors.Length - 1;
}
else
{
currentColorIndex -= 1;
}
DisplayColor();
}
protected void buttonDown_Click(object sender, EventArgs e)
{
if(currentColorIndex == (colors.Length - 1))
{
currentColorIndex = 0;
}
else
{
currentColorIndex += 1;
}
DisplayColor();
}
</script>
<asp:TextBox ID= “textColor” runat= “server”
ReadOnly= “True” />
<asp:Button Font-Bold= “True” ID= “buttonUp” runat= “server”
Text= “^” OnClick= “buttonUp_Click” />
<asp:Button Font-Bold= “True” ID= “buttonDown” runat= “server”
Text= “v” OnClick= “buttonDown_Click” />
8.2.2 How to Convert Web Form Pages into ASP.NET User Control
If you have developed an ASP.NET Web page and would like to access its functionality
throughout your application, you can make some minor alterations to the page to change it to
a user control.
152 LOVELY PROFESSIONAL UNIVERSITY