Ok, this is the code, i'm using Pubs Data Base, in Page_Load event i fill a dataset with a record from employee, then set the job_id in CascadingDropDown_Job.SelectedValue, when i load step 2 set pub_id in CascadingDropDown_publisher.SelectedValue,then in step 1 and 2 i read the TEXT selected, but in step 3 i can't obtain the rigth DropDownList_Job.SelectedItem.Text and DropDownList_publisher.SelectedItem.Text, if i back to step 1 o 2 and select another item in de dropdownlist , when i return to step 3 now i read the rigth DropDownList_Job.SelectedItem.Text and DropDownList_publisher.SelectedItem.Text.
MyPage.aspx:
<%@ Page Language="VB" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
Dim Connection As New SqlConnection("Data Source=localhost;Initial Catalog=Pubs;Integrated Security=True")
Connection.Open()
Dim Command As New SqlCommand("select * from employee where emp_id='PMA42628M'", Connection)
Dim DataAdapter As New SqlDataAdapter(Command)
Dim DataSet As New Data.DataSet
DataAdapter.Fill(DataSet)
Me.CascadingDropDown_Job.SelectedValue = DataSet.Tables(0).Rows(0)("job_id")
'this line don't work, but i hope work in future release
'Me.CascadingDropDown_publisher.SelectedValue = DataSet.Tables(0).Rows(0)("pub_id")
End If
Page.DataBind()
End Sub
Protected Sub Wizard1_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Select Case Wizard1.ActiveStepIndex
Case 1
If Me.PostBack_Step2.Value = "0" Then
Dim Connection As New SqlConnection("Data Source=localhost;Initial Catalog=Pubs;Integrated Security=True")
Connection.Open()
Dim Command As New SqlCommand("select * from employee where emp_id='PMA42628M'", Connection)
Dim DataAdapter As New SqlDataAdapter(Command)
Dim DataSet As New Data.DataSet
DataAdapter.Fill(DataSet)
'this line work fine
Me.CascadingDropDown_publisher.SelectedValue = DataSet.Tables(0).Rows(0)("pub_id")
'-------------------------
Me.PostBack_Step2.Value = "1"
Else
'ActiveStepChanged code
End If
Case 2
If Me.PostBack_Step3.Value = "0" Then
'postback step3
Me.PostBack_Step3.Value = "1"
Else
'ActiveStepChanged
End If
End Select
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Wizard ID="Wizard1"
runat="server" ActiveStepIndex="0" BackColor="#FFFBD6" BorderColor="#FFDFAD"
BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" Height="232px"
Width="456px" OnActiveStepChanged="Wizard1_ActiveStepChanged">
<SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />
<NavigationButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" />
<WizardSteps>
<asp:WizardStep runat="server" StepType="Start" Title="Step 1">
<asp:DropDownList ID="DropDownList_Job" runat="server">
</asp:DropDownList>
<br />
<br />
<cc1:CascadingDropDown ID="CascadingDropDown_Job" runat="server" BehaviorID="Wizard1_CascadingDropDown1"
Enabled="True" TargetControlID="DropDownList_Job" ServiceMethod="Jobs" ServicePath="MyWebService.asmx" LoadingText="Loading..." PromptText="Select" Category="Job">
</cc1:CascadingDropDown>
</asp:WizardStep>
<asp:WizardStep runat="server" StepType="Step" Title="Step 2">
<asp:DropDownList ID="DropDownList_publisher" runat="server">
</asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDown_publisher" runat="server" BehaviorID="Wizard1_CascadingDropDown_publisher"
Category="Publisher" Enabled="True" LoadingText="Loading..." PromptText="Select"
ServiceMethod="Publishers" ServicePath="MyWebService.asmx" TargetControlID="DropDownList_publisher">
</cc1:CascadingDropDown>
</asp:WizardStep>
<asp:WizardStep runat="server" StepType="Finish" Title="Step 3">
Job :
<asp:Label ID="Label1" runat="server" Text='<%# DropDownList_Job.SelectedItem.Text %>'></asp:Label>
<br />
CascadingDropDown_Job:
<asp:Label ID="Label3" runat="server" Text='<%# CascadingDropDown_Job.SelectedValue %>'></asp:Label>
<br />
<br />
Publisher:
<asp:Label ID="Label2" runat="server" Text='<%# DropDownList_publisher.SelectedItem.Text %>'></asp:Label>
<br />
CascadingDropDown_publisher:
<asp:Label ID="Label4" runat="server" Text='<%# CascadingDropDown_publisher.SelectedValue %>'></asp:Label>
</asp:WizardStep>
</WizardSteps>
<SideBarButtonStyle ForeColor="White" />
<HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6" BorderStyle="Solid" BorderWidth="2px"
Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" />
</asp:Wizard>
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:HiddenField ID="PostBack_Step2" runat="server" Value="0" />
</div>
<asp:HiddenField ID="PostBack_Step3" runat="server" />
</form>
</body>
</html>
MyWebService.asmx:
<%@ WebService Language="VB" Class="MyWebService" %>
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data.SqlClient
Imports System.Data
Imports AjaxControlToolkit
Imports System.Collections.Generic
<WebService(Namespace:="http://tempuri.org/")> _
<Web.Script.Services.ScriptService()> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MyWebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function Jobs(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim Connection As New SqlConnection("Data Source=localhost;Initial Catalog=Pubs;Integrated Security=True")
Connection.Open()
Dim Command As New SqlCommand("select job_desc, job_id from jobs", Connection)
Dim DataAdapter As New SqlDataAdapter(Command)
Dim DataSet As New Data.DataSet
DataAdapter.Fill(DataSet)
Dim Result As New List(Of CascadingDropDownNameValue)
For Each row As DataRow In DataSet.Tables(0).Rows
Result.Add(New CascadingDropDownNameValue(row("job_desc"), CStr(row("job_id"))))
Next
Return Result.ToArray()
End Function
<WebMethod()> _
Public Function Publishers(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim Connection As New SqlConnection("Data Source=localhost;Initial Catalog=Pubs;Integrated Security=True")
Connection.Open()
Dim Command As New SqlCommand("select pub_name, pub_id from publishers ", Connection)
Dim DataAdapter As New SqlDataAdapter(Command)
Dim DataSet As New Data.DataSet
DataAdapter.Fill(DataSet)
Dim Result As New List(Of CascadingDropDownNameValue)
For Each row As DataRow In DataSet.Tables(0).Rows
Result.Add(New CascadingDropDownNameValue(row("pub_name"), CStr(row("pub_id"))))
Next
Return Result.ToArray()
End Function
End Class