Mainpage code behind. This is pulling the user's name that the user enter at login. The session works for this.
Dim strAuthUsr as String
strAuthUsr = Session("AuthUsr")
This is where I put the tag:
Onclick = "windowOpen('http://intranet/Quotes/NewQuote.aspx?user=<%#strAuthUsr%>', 'NewQuote');"
New window that is being open from the javascript above that uses the querystring:
Dim strAuthUser As String
strAuthUsr = Request.QueryString("user")
txbUser.Text = strAuthUsr
The only thing output I got for that textbox is <%. I'm not sure if my syntax is right, but please advise.Why not:
Onclick = "windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUsr & "', 'NewQuote');"
You are constructing this in the code-behind, right?
Brian
<Elmer Fudd Voice>
Be veddy veddy karefull when using popups... huhuhuhuhuh...
</Elmer Fudd Voice
Most browsers block them by default these days, this can cause you ALOT of pain.
Just a thought.
Brian,
I tried using the syntax as you suggested, but I get an error. Says that the server tag is not well formed.
There's also squiggle line under the strAuthUsr string. Says that it could not find any attribute 'strAuthUsr' of element 'input'
Yes, I am constructing this in the code-behind.
The Quote.aspx.vb is coded as followed:
Dim strAuthUsr as StringstrAuthUsr = Session("AuthUsr")
From the Quote.aspx is coded as followed:
Onclick="windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUser & "', 'NewQuote');"
This is for the pop window:
Dim strAuthUsr As StringstrAuthUsr = Request.QueryString("user")
txbUser.Text = strAuthUsr
I want to pass the user name from session that the user entered to get into the main page to be displayed on the txbUser.Text textbox.
I can pass the variable from page to page, but somehow this pop up window is not letting me. I don't know if the javascript has anything to do with it, but I doubt it.
<script language="javascript">
function windowOpen(sURL,sWinName){
var params = 'height=410,width=450,directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=no,resizeable=no';
window.open(sURL,sWinName,params);
}
</script
Please advise.
Probably I should ask this. The string "strAuthUsr = Session("AuthUsr")" does show the username when I go to debug.
The
Onclick="windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUser & "', 'NewQuote');", I'm assuming should pull that variable. Is there a way to see if the username is being pull? I did try a
Response.Write("user"), but all i'm getting is sometime <% or sometime nothing.
From my understanind the strAuthUsr string should be pass as variable when using <%#strAuthUsr%>, but I'm not sure why it's not doing that in this case.
Any suggestions on how I can do a generic pass, for example something static just to make sure that it does pass from one page to the next?
I beleive if you use my free controlPopUpWindow 1.1, you would have any problem. Since you can open a pop up window from inside server-side.
regards
For this to work, this can't be in aspx:
Onclick="windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUser & "', 'NewQuote');"
You need to add it in .aspx.vb file. You may be able to do this through the Attributes.Add, which would add it so that it would render directly as is on the client.
Brian
In addition, if the user name is stored in the Session, it may be better to keep it there, redirect to the page, and check the session for this value, instead of going server/client, and then most likely server again. Or are you posting it outside your web site.
Brian
Brian thanks for responding. I'm not really clear on your post. For the code that I posted
Onclick="windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUser & "', 'NewQuote');"
How could this be in aspx.vb file when this is for the aspx server tag? The entire code for this is like this.
<input id="btnNewQuote" type="button" Onclick="windowOpen('http://intranet/Quotes/NewQuote.aspx?user=" & strAuthUser & "', 'NewQuote');"
value = "New Quote" runat="server" >
As for the session, it does not work because this is passing it from my page to a pop up window. I tried to call it from my previous page for the session variable and hopefully be able to pass it to the pop window, but it's not grabbing the value.
Any ideas?
I would recommend you check my control. It has what you need.
regards
haidar bilal, I had downloaded your control and will use it. If I have any questions, I will post you some.
Thanks.
Haidar Bilal,
Can your control open multiple pop up windows? I want to open a pop for users to fill in a small form, and from that pop up they can click on a button to open another pop where it has list of customers that they can click on to have those information filled in to the first pop up window.
So far, each pop up that i will replaces the current pop up window. WOndering if it can be done and how.
Thanks.
I hate to be redundent but you guys are going to need to be VERY carefull with popups. Almost all browsers have default popup blockers in them. Including IE6 with SP2 and Firefox 1.0.
Some popup blockers are even starting to block user execute popups.
You'll save yourself time and frustration if you avoid them.
Hope this helps,
Thanks for the warning adurstew, but this is for an intranet portal application. We had used it in the past with no problem so I don't see it as a concern.
Are your users running Windows XP? If so when your company rolls out SP2 a popup blocker is installed and running by default.
0 comments:
Post a Comment