Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Saturday, March 31, 2012

Set a hyperlink to open in window.

how do you set a hyperlink to open the link in a new window/browser, so I dont lose my current place in the site.

you have to do this with client code

<a href="http://links.10026.com/?link=blah" TARGET="_new"...>

the "_new" is a name you assign to a window. Use that with more then one call and they will reuse the window.

You can't specify the window (new or otherwise) with a Response.Redirect() or any other server call, sorry...


If you need to do this in the code behind and not in the HTML you can use this syntax:

Me.ClientScript.RegisterClientScriptBlock(Me.GetType,"open","<script language=javascript>window.open('http://www.yourpage.aspx');</script>")


Simply the below code

<a href="http://links.10026.com/?link=WebForm1.aspx" target="_blank">Open new window</a>

HC


As everybody as already said

<a href="http://links.10026.com/?link=URL" target="_blank>Clicking on this opens a new window</a>

however if you are using hyperlink button in asp.net then

<asp:HyperLinkid="value"Runat="Server"
ImageUrl="url"
NavigateUrl="url"
Target="_blank|_self|_top|_parent|framename"
Text="string"
property="value"
Style="CSS style settings..."
/>

you can choose target=_blank as described.

Hope that helps and good luck

Set A Parameter Without Redirecting A Page?

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.

Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL
>
without using response.redirect?
>
I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?
>
also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?
>
thanks!
>


ok, thanks mark.

i dont think this will work as the updated parameter is created in a
while
loop that outputs many values - this is a count.

what i have done is pass my url querystring through a hidden iframe
from
the referring page (i am uploading files). now, what i want to do is
send a
count back to the referring page (the count represents upload time). i
thought i might be able to do this in the querystring but this would
cause
numerous postbacks in sequence - not pretty.

since it looks like doing it via the querystring is a no-go, do you
have any ideas how
i might send the upload count back to the referring page? is it
possible to send an ajax response from the server when the client does
not initiate the call?

thanks.
peter

Mark Fitzpatrick wrote:

Quote:

Originally Posted by

Querystring parameters cannot be reset dynamically as they represent a
read-only collection of items in the url.
>
Of course, something else you could do would be to have a series of local
variables or protected properties that would initially populate from this
list, then change the variable in postback. This would work nicely if you're
using AJAX because then you wouldn't be posting back the whole page. If
you're not using AJAX, then using a response.redirect doesn't effect you
much because you'll have a full page postback and might as well do the
redirect to avoid worrying about keeping parameter updates in a viewstate.
>
>
--
>
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
>
>
>
"pbd22" <dushkin@.gmail.comwrote in message
news:1167335417.354465.213040@.n51g2000cwc.googlegr oups.com...

Quote:

Originally Posted by

can somebody tell me how to set a parameter of my current URL

without using response.redirect?

I am trying to set a parameter - ResponseId = 4 inside a while loop. is
this possible?

also, is it possible to replace the value of the ResponseId parameter
to, say "5" in the same way?

thanks!

Thursday, March 29, 2012

Set Culture in Web.config

How can I set the current web culture (CultureInfo) in the
web.config?
Apogeesee the <globalization> tag
"Apogee" <developer@.biteish.net> wrote in message
news:OV6o43JTEHA.1244@.TK2MSFTNGP10.phx.gbl...
> How can I set the current web culture (CultureInfo) in the
> web.config?
> Apogee
>

Set Culture in Web.config

How can I set the current web culture (CultureInfo) in the
web.config?

Apogeesee the <globalization> tag

"Apogee" <developer@.biteish.net> wrote in message
news:OV6o43JTEHA.1244@.TK2MSFTNGP10.phx.gbl...
> How can I set the current web culture (CultureInfo) in the
> web.config?
> Apogee

Tuesday, March 13, 2012

Set selected in a BulletedList

I would like set "Selected = True" where the listitem value equals the current page.

<asp:BulletedList ID="Navigate" runat="server" DisplayMode="HyperLink">
<asp:ListItem Value="localhost">Home</asp:ListItem>
<asp:ListItem Value="localhost/link1">Link1</asp:ListItem>
<asp:ListItem Value="localhost/link2">Link2</asp:ListItem>
<asp:ListItem Value="localhost/link3">Link3</asp:ListItem>
</asp:BulletedList>

I just don't see how yet. Could someone point me in the right direction?

Thnx,

Jacco

You need to get into your codebehind and do something like this.

Navigate.SelectedValue = Page.Title


First you need to get the name of the current page. In your page directive, set
Trace="True"

Look at the list of Server Variable items in the list - PathInfo, Path Translated, ScriptName, etc - grab the one you want, and parse it to match however you're writing out your list items.

Create a variable in the page:
Dim sPage as String
Then, when the page loads (in the Page_load routine), put something like:

if not Page.IsPostback then
Dim itmAs ListItem
ForEach itmIn RadioButtonList1.Items
If itm.Text = sPageThen
itm.Selected =True
EndIf
Next
End if

Almost there.

Now I've got:

Dim itm As ListItem
Dim sDom As String = Request.ServerVariables("HTTP_HOST")
Dim sPage As String = "http://" & sDom & Request.ServerVariables("SCRIPT_NAME")
For Each itm In navigate.Items
If itm.Value = sPage Then
itm.Selected = True
End If
Next

In the debugger I see it reaches the itm.Selected only once for my four links when the Value equals sPage. But when I view the source code of the page there's still no selected item. What's missing?

Thnx,

Jacco


BTW, This does work:

If itm.Value = sPage Then
itm.Text = "|" & itm.Text & "|"
End If

Why won't it write out selected when itm.Selected is used?

Thnx,

Jacco


not sure - that code I wrote was off the top of my head (ottomh), so I really should have put a disclaimer

:)

you might try something more along the lines of:
Navigate.Items.FindByText(itm.Value).Selected = true

again - a little more off the top


I appreciate all the help. So, don't worry :-)

I've tried it and it has the same result.

The goal is to get my bulleted CSS list to display correctly. In classic ASP I did something like:

<% if urlcheck = "/web" then %> id="current"<% end if %>

Maybe I'm trying in the wrong direction.

Thnx.