Tom Knowlton
asked on
Clear __EVENTARGUMENT?
Is there a way to CLEAR __EVENTARGUMENT or set it to null or to some other value in the C# code behind.
I have a dynamic control with buttons inside of it.
I have the Button onclick set to run a Javascript function where it sets the __EVENTARGUMENT.
But it seems to be firing multiple times, even though I am only clicking the button once.
I have a dynamic control with buttons inside of it.
I have the Button onclick set to run a Javascript function where it sets the __EVENTARGUMENT.
But it seems to be firing multiple times, even though I am only clicking the button once.
ASKER
Cannot do that.
Request["__EVENTARGUMENT"]
is read-only.
It is javascript that is populating the event argument.
What I don't understand is why it is firing TWICE.
Request["__EVENTARGUMENT"]
is read-only.
It is javascript that is populating the event argument.
What I don't understand is why it is firing TWICE.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
First things first...I'm in C#. :)
The event is being wired thus in the Page_Load for the custom button control:
protected void Page_Load( object sender, EventArgs e )
{
Button1.Attributes.Clear() ;
this.Button1.Attributes.Ad d("onclick ","Respond ToNewRowCl ick(this)" );
}
RespondToNewRowClick(this is a javascript function that looks like this:
<script type="text/javascript">
function RespondToNewRowClick(curre nt)
{
__doPostBack(current.value ,'NEWROWBU TTONCLICK' );
}
</script>
When the button is clicked, on the server side code I respond to the message:
protected void Page_Load( object sender, EventArgs e )
{
string tempArgument = Request.Params.Get("__EVEN TARGUMENT" );
if (tempArgument == "NEWROWBUTTONCLICK")
{
AddToColl();
TESTCOLLECTION1.AddControl Collection ((List<Con trol>)Cach e["ctrls"] );
}
if (!Page.IsPostBack)
{
Cache.Remove("ctrls");
AddToColl();
TESTCOLLECTION1.AddControl Collection ((List<Con trol>)Cach e["ctrls"] );
}
}
I hope this helps you help me some. :)
The event is being wired thus in the Page_Load for the custom button control:
protected void Page_Load( object sender, EventArgs e )
{
Button1.Attributes.Clear()
this.Button1.Attributes.Ad
}
RespondToNewRowClick(this is a javascript function that looks like this:
<script type="text/javascript">
function RespondToNewRowClick(curre
{
__doPostBack(current.value
}
</script>
When the button is clicked, on the server side code I respond to the message:
protected void Page_Load( object sender, EventArgs e )
{
string tempArgument = Request.Params.Get("__EVEN
if (tempArgument == "NEWROWBUTTONCLICK")
{
AddToColl();
TESTCOLLECTION1.AddControl
}
if (!Page.IsPostBack)
{
Cache.Remove("ctrls");
AddToColl();
TESTCOLLECTION1.AddControl
}
}
I hope this helps you help me some. :)
Huh, that's odd.
Could you try adding an alert(current.id); statement into the RespondToNewRowClick event to see if the javascript is also being called more than once?
Please make note of the id's it returns, just in case.
Could you try adding an alert(current.id); statement into the RespondToNewRowClick event to see if the javascript is also being called more than once?
Please make note of the id's it returns, just in case.
Request["__EVENTARGUMENT"]