PDA

View Full Version : Values stored in Request.Form[i]



coplaxi
23 Jul 2009, 3:35 PM
Okay I think I just figured out the answer. But let me first pose the question to an expert and they can confirm that my answer is correct.
Basically, I am working with the really cool extjs drag and drop tree functionality. (with asp.net web forms) Basically let me get to the point here though.
I have several parent nodes. When I drag and drop a leaf node value onto the parent node of a different parent node, my code executes the below code in default.aspx. Basically it sets the parameters for the page that is to recieve
he post (updateorg.aspx). So my question is when code execution transfers to my updateorg.apx.cs code, how do
I get the node values that were assigned in default.aspx? Namely node.id, newParent.id, oldParent.id
I think the answer is that they reside in the Request.Form[i] values.
So Request.Form[0] contains the value for node.id
Request.Form[1] contains the value for newParent.id
Request.Form[2] contains the value for oldParent.id
Is that the correct answer? see my comments below.

default2.aspx

Ext.Ajax.request({
url: 'updateorg.aspx',
method: 'post',
params: {
nodeid: node.id,
newparentid: newParent.id,
oldparentid: oldParent.id,
dropindex: index
}
});

updateorg.aspx.cs
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class updateorg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// How do I get the values that were sent from default2.aspx ?
// Namely node.id, newParent.id, oldParent.id
// Currently I only know how to get the value node.id
// which is stored in Request.Form[0]
int selectedID = 0;
if (Request.Form.Count != 0 && Request.Form[0] != "source")
Int32.TryParse(this.Request.Form[0], out selectedID);
}
}