You just need to pass the selected value on a query string to the second
page and pick it up there.
Here's the idea. Let us know if it helps?
Ken
Microsoft MVP [ASP.NET]
Here's pg1.aspx
<%@ Page Language="VB" %>
<!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 Button1_Click _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
Response.Redirect("pg2.aspx?id=" & _
DropDownList1.SelectedValue.ToString)
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:dropdownlist id="DropDownList1" runat="server">
<asp:listitem value="0">George</asp:listitem>
<asp:listitem value="1">John</asp:listitem>
<asp:listitem value="2">Mary</asp:listitem>
</asp:dropdownlist><br />
<br />
<asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Button" /> </div>
</form>
</body>
</html>
Here's pg2.aspx
<%@ Page Language="VB" %>
<!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)
Dim strID As String
If Not IsNothing(Request("id")) Then
strID = Request("id")
Label1.Text = strID
dg.DataSourceID = strID
End If
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:label id="Label1" runat="server"></asp:label><br />
<br />
<asp:datagrid id="dg" runat="server" ></asp:datagrid></div>
</form>
</body>
</html>
Monty said:
Hi there,
From one page, I have created a dropdown list of employees. When an
employee is selected, I would like another page to open, based upon the
employee. Here is my question...
How do I change the datasource.id of a grid on another page as it is
opening?
Thank you, Mark