hey all,
i know i can do response.redirect("my.aspx?id=1")
but what if i'm doing a postback, is there something similar to querystring?
thanks,
rodchar
Hi Rod
Sometimes when there is no another option I use this trick below
(there are two pages):
Page 1 : HiddenValue.aspx
---------------------------------------
<%@ Page Language="c#" Debug="true" %>
<%@ Import Namespace="System.Text" %>
<script language="c#" runat="server">
public void ButtonConfirmar1_Click (object sender, EventArgs e)
{
Hidden1.Value = TextBox1.Text.ToUpper();
Hidden2.Value = TextBox2.Text.ToUpper();
// javascript: watch out with the Form's name (here is Form1)
StringBuilder script = new StringBuilder();
script.AppendFormat("<script language='javascript'>");
script.AppendFormat("document.getElementById('Form1').action='HiddenValueProcess.aspx';");
script.AppendFormat("document.forms[0].__VIEWSTATE.name =
'NOVIEWSTATE';");
script.AppendFormat("document.getElementById('Form1').submit();</
script>");;
Page.RegisterStartupScript("submitForm", script.ToString());
}
</script>
<form id="Form1" method="post" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<INPUT id="Hidden1" runat="server" type="hidden">
<INPUT id="Hidden2" runat="server" type="hidden">
<asp:Button ID="ButtonConfirmar1" runat="server" Text="Confirmar"
OnClick="ButtonConfirmar1_Click"/>
</form>
Page 1 : HiddenValueProcess.aspx
---------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
string value1 = Request.Form["Hidden1"].ToString();
string value2 = Request.Form["Hidden2"].ToString();
Response.Write("<p>Valor 1=" + value1);
Response.Write("<p>Valor 2=" + value2);
}
}
This is what are you looking for. aren't you?