calling page has a master
calling control:
<asp:Button ID="btnSendAlert" runat="server" Text="Go"
onclick="btnSendAlert_Click" PostBackUrl="ItemUpLoadAdmin.aspx"
CommandArgument="5" />
receiving page
if (PreviousPage != null)
{
Button btn = (Button)PreviousPage.FindControl("btnSendAlert");
Response.Write(btn.Text); <--- errors here with null reference
}
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
"WebBuilder451" <WebBui...@discussions.microsoft.com> wrote in message
news:3D7D0D4D-9E5A-4BAD...@microsoft.com...
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
[source page]
public String ButtonClientID
{
get
{
return btnSendAlert.ClientID;
}
}
[.aspx destination page]
Make sure that a reference to the previous page is declared at the top like
this:
<%@ PreviousPageType VirtualPath="~/SourcePage.aspx" %>
[.aspx.cs destination page]
if (PreviousPage != null)
{
Button btn =
(Button)PreviousPage.FindControl(PreviousPage.ButtonClientID);
Response.Write(btn.Text);
}
Good luck!
-Scott
"WebBuilder451" <WebBui...@discussions.microsoft.com> wrote in message
news:BA86E5D2-43B7-4173...@microsoft.com...
page on in sub directory with master:
public partial class Admin_x : System.Web.UI.Page
{
public String ButtonClientID
{
get
{
return btnSendAlert.ClientID;
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
page 2 header with reference:
<%@ Page Language="C#" MasterPageFile="~/Admin/adminMasterPage.master"
AutoEventWireup="true" CodeFile="y.aspx.cs" Inherits="Admin_y"
Title="Untitled Page" %>
<%@ PreviousPageType VirtualPath="~/Admin/x.aspx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
</asp:Content>
page 2 code behind:
public partial class Admin_y : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
Response.Write(PreviousPage.ButtonClientID.ToString());
Response.Write("<BR />");
Button btn =
(Button)PreviousPage.FindControl(PreviousPage.ButtonClientID);
if (btn == null)
Response.Write("NG");
else
Response.Write("OK");
-Scott
"WebBuilder451" <WebBui...@discussions.microsoft.com> wrote in message
news:6EAFC023-229E-4FE1...@microsoft.com...
-Scott
"WebBuilder451" <WebBui...@discussions.microsoft.com> wrote in message
news:3ADA192E-8E5E-4AE2...@microsoft.com...
(you can confirm this by not only looking
> at the response.write, but also by looking at the rendered source code and
> find the control yourself) Have not confirmed that the control is there, but intelesense get the value it writes.