<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default13.aspx.cs" Inherits="Default13" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function showtext() {
var len = document.getElementById('AddPropertyWizard_lst').value.length;
if (len <= 0) {
alert('enter something');
return false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sc1" runat="server"></asp:ScriptManager>
<table border="1">
<tr>
<td>
<asp:Wizard ID="AddPropertyWizard" runat="server" ActiveStepIndex="0"
Width="98%" margin-left="10px"
DisplaySideBar="False">
<StartNavigationTemplate>
<asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" OnClick="AddPropertyWizard_NextButtonClick"
Text="Next" />
</StartNavigationTemplate>
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server">
<table>
<tr>
<td>UserName:</td>
<td>
<asp:TextBox ID="txtuser" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td> Password:</td>
<td>
<asp:TextBox ID="txtpass" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server">
<table>
<tr>
<td>Address:</td>
<td>
<asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Phone:</td>
<td>
<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server">
<table>
<tr>
<td> Office:</td>
<td>
<asp:TextBox ID="txtOffice" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td> Map:</td>
<td>
<asp:TextBox ID="txtMap" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:ListBox ID="lst" runat="server" Width="100px" onKeyDown='showDialog("Down")' onKeyPress='showDialog("Press")'>
</asp:ListBox>
<asp:Button ID="fill" runat="server" Text="Fill" OnClick="fill_Click" />
</td>
</tr>
</table>
</asp:WizardStep>
</WizardSteps>
<FinishNavigationTemplate>
<asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" OnClick="AddPropertyWizard_FinishButtonClick"
Text="Finish" />
</FinishNavigationTemplate>
<HeaderTemplate>
Wizard Example
</HeaderTemplate>
<StepNavigationTemplate>
<asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" OnClick="AddPropertyWizard_PreviousButtonClick"
Text="Previous" />
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" OnClick="AddPropertyWizard_NextButtonClick" />
</StepNavigationTemplate>
</asp:Wizard>
</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td>
<asp:Label ID="lbl1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl2" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl3" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl4" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl5" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbl6" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default13 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ClickButton();
}
public void ClickButton()
{
Button btn = AddPropertyWizard.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton") as Button;
if (btn != null)
{
btn.OnClientClick = "return confirm('Are you sure you want to move away from the beginning?')";
}
btn = AddPropertyWizard.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton") as Button;
if (btn != null)
{
btn.OnClientClick = "return confirm('Are you positive you want to move next?')";
}
btn = AddPropertyWizard.FindControl("StepNavigationTemplateContainerID").FindControl("StepPreviousButton") as Button;
if (btn != null)
{
btn.OnClientClick = "return confirm('Are you sure you want to go back?')";
}
btn = AddPropertyWizard.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishPreviousButton") as Button;
if (btn != null)
{
btn.OnClientClick = "confirm('Almost there!?')";
}
btn = AddPropertyWizard.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishButton") as Button;
if (btn != null)
{
btn.OnClientClick = "return showtext()"; //confirm('Almost there!?')
}
}
protected void fill_Click(object sender, EventArgs e)
{
lst.Items.Add("One");
//when listbox2 is filled then make SelectedIndex = 0, otherwise dont set SelectedIndex;
lst.SelectedIndex = 0;
}
protected void AddPropertyWizard_NextButtonClick(object sender, EventArgs e)
{
int Index = Convert.ToInt32(AddPropertyWizard.ActiveStepIndex);
switch (Index)
{
case 0:
AddPropertyWizard.ActiveStepIndex = 1;
break;
case 1:
AddPropertyWizard.ActiveStepIndex = 2;
break;
case 2:
AddPropertyWizard.ActiveStepIndex = 3;
break;
}
}
protected void AddPropertyWizard_PreviousButtonClick(object sender, EventArgs e)
{
int Index = Convert.ToInt32(AddPropertyWizard.ActiveStepIndex);
switch (Index)
{
case 1:
AddPropertyWizard.ActiveStepIndex = 0;
break;
case 2:
AddPropertyWizard.ActiveStepIndex = 1;
break;
case 3:
AddPropertyWizard.ActiveStepIndex = 2;
break;
}
}
protected void AddPropertyWizard_FinishButtonClick(object sender, EventArgs e)
{
lbl1.Text = "The UserName is :" + txtuser.Text + "\n";
lbl2.Text = "The Password is:" + txtpass.Text + "\n";
lbl3.Text = "The Address is:" + txtAddress.Text + "\n";
lbl4.Text = "The Phone is:" + txtPhone.Text + "\n";
lbl5.Text = "The Office is:" + txtOffice.Text + "\n";
lbl6.Text = "The Map is:" + txtMap.Text + "\n";
//
}
}
0 comments:
Post a Comment