Malin
11-16-2004, 02:12 AM
Hi
I have an application that is looping some articles out (information about each of them in amall tables). Every articletable includesone "publish button".
Like:
"Aticle one"
By: Malin
Date: 2004-04-04
PUBLISH
"Aticle two"
By: Malin
Date: 2004-05-05
PUBLISH
I have set CommandArgument to the articleid and then when command event fires when the button is clicked the method btnReg_command is invoked. In the method I take out the articleid from e.commandargument and puts it into the session object. Then I want to Resonse.Redirect to a pop up window. I know that this is not possible (from what I have read about it) so I have tried to solve it by adding the javascript to open the popup in the onclick event. Now this is the irritating part. Sometimes the commandevent fires more slowly then the clickevent and this gives the result that when the pop up opens the articleid from the oncommand method is not in place in session when the pop up loads and the articleid is used in the popup page's code behind. Sometimes the articleid is in the session object in time..and sometimes not.
Is there a way I can make this work??
Here is parts of my code...the relavant parts:
The Button code:
----------------------------------------------------
System.Web.UI.WebControls.Button btnReg = new Button();
btnReg.Command += new System.Web.UI.WebControls.CommandEventHandler(this .btnReg_Command);
btnReg.CommandArgument = dsResult.Tables[0].Rows[i].ItemArray[0].ToString(); (the articleid)
btnReg.Attributes.Add("onclick", "javascript:window.open('regPublish.aspx','regwin', 'scrollbars=no,width=530,height=500');");
The commandevent method code:
----------------------------------------------------
protected void btnReg_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
{
Session.Add("chosenArticle", e.CommandArgument.ToString());
}
-------------------------
The problem is that when regPublish.aspx is opened it uses the "chosenArticle" in the session object and sometimes it is not there because the pop up is loaded faster than the commandevent i fired..I think??
Any ideas about how I can solve this problem?
Malin
(I cannnotmake the blue text black ..sorry)
I have an application that is looping some articles out (information about each of them in amall tables). Every articletable includesone "publish button".
Like:
"Aticle one"
By: Malin
Date: 2004-04-04
PUBLISH
"Aticle two"
By: Malin
Date: 2004-05-05
PUBLISH
I have set CommandArgument to the articleid and then when command event fires when the button is clicked the method btnReg_command is invoked. In the method I take out the articleid from e.commandargument and puts it into the session object. Then I want to Resonse.Redirect to a pop up window. I know that this is not possible (from what I have read about it) so I have tried to solve it by adding the javascript to open the popup in the onclick event. Now this is the irritating part. Sometimes the commandevent fires more slowly then the clickevent and this gives the result that when the pop up opens the articleid from the oncommand method is not in place in session when the pop up loads and the articleid is used in the popup page's code behind. Sometimes the articleid is in the session object in time..and sometimes not.
Is there a way I can make this work??
Here is parts of my code...the relavant parts:
The Button code:
----------------------------------------------------
System.Web.UI.WebControls.Button btnReg = new Button();
btnReg.Command += new System.Web.UI.WebControls.CommandEventHandler(this .btnReg_Command);
btnReg.CommandArgument = dsResult.Tables[0].Rows[i].ItemArray[0].ToString(); (the articleid)
btnReg.Attributes.Add("onclick", "javascript:window.open('regPublish.aspx','regwin', 'scrollbars=no,width=530,height=500');");
The commandevent method code:
----------------------------------------------------
protected void btnReg_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
{
Session.Add("chosenArticle", e.CommandArgument.ToString());
}
-------------------------
The problem is that when regPublish.aspx is opened it uses the "chosenArticle" in the session object and sometimes it is not there because the pop up is loaded faster than the commandevent i fired..I think??
Any ideas about how I can solve this problem?
Malin
(I cannnotmake the blue text black ..sorry)