change menu's property Target in client-side (javascript)

Hi all !

I need to be able to change the target of my menu (regular asp.net control) in client-side using javascript. Does anyone have a clue or tip?

Thanks a lot !


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 1:17:40 AM
asp.net.client-side 24353 articles. 1 followers. Follow

10 Replies
479 Views

Similar Articles

[PageSpeed] 6

Since every server side control renders finally as HTML, you must be able to access each HTML element rendered using javascript and do any changes but, I did not understand what Menu target means. other than that you can view source to see how the Menu control is rendered and use js to modify any part thereof. 


Thanks,
Ravikanth

Please "Mark as Answer" if you find this post useful
0
gravyty
12/11/2008 5:33:18 AM

Hi, server Menu control has a property Target, which I can use to set its location (_blank, parent, a specific frame etc). Well, what I want is being able to tell the menu control in client-side if it will open a new window (_blank) when I choose a menu option or open it inside the iframe. That will depend on a checkbox I have placed on the main frame. Why that? Because I want to give the user kind of a window experience, where he may be able to open several windows (pages) at the same time or work in a standard way (opening inside the iframe)...

Could you elaborate a little more on how to use jscript to do these changes?


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 9:44:04 AM

Ive read something about "forcing" the <A > entry, but I dont know how to proceed...


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 1:49:56 PM

Like gravyty posted: bring the page up in a browser, do a View Source to see how the Menu control is rendered, and use JavaScript to modify any part thereof.

NC...

0
NC01
12/11/2008 3:17:31 PM

Hi NC,

Ok, I know all the <A Href... that point to the menu entries...that I can see in the code spit on the page. But then, how will I manage to change it? I cant go one by one, how would I loop ? And most important, which "event" should fire this loop (if its a loop) ?


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 3:23:57 PM

If that <a> tag has an ID property, try this:

document.getElementById('a-tag-id').target = '_parent';

If it doesn't have an ID property, you're pretty much out of luck.

NC...

0
NC01
12/11/2008 3:46:25 PM

How will I loop through all the <a> tags, each one corresponding to a menu entry?


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 3:54:37 PM

Try this:

<script type="text/javascript">
<!--
function iterateThroughMenu()
{
 var menuRef = document.getElementById('<%= Menu1.ClientID %>');
 var anchorArray = menuRef.getElementsByTagName('a');

 for (var i=0; i<anchorArray.length; i++)
 {
  // Do something with "anchorArray[i]" here...
 }
}
// -->
</script>

NC...

 

0
NC01
12/11/2008 4:02:53 PM

hmmm...

alert(anchorArray.length);

is displaying 0, how is it possible?? I see all menu entries in my source code!

:( 

 

 


We are here to learn, and teach whenever possible...
0
rtortima
12/11/2008 4:33:37 PM

rtortima:

hmmm...

alert(anchorArray.length);

is displaying 0, how is it possible?? I see all menu entries in my source code!

:( 

 

 

I have no idea as I left my X-Ray vision glasses at home this morning so I can't see your code. Wrong ID maybe???

NC...

 

0
NC01
12/11/2008 5:38:15 PM
Reply:

Similar Artilces:

Can you change a linkbutton's text using client side javascript?
I have a linkbutton which opens a new window. When the user closes the new window, I want to change the text of the original linkbutton. The issue isn't the popup window since know how to use window.opener. The problem is that I don't know how to use javascript to change the inner text of the linkbutton which I know is rendered as anchor tags. Any suggestions? Hi, on the Page where the LinkButton is, you can output the client-side ID of the LinkButton with it's ClientID property assuming you have <asp:LinkButton ID="LinkButton1" runat="server" Text="Hello" />So you could ou...

Adding custom properties to validator control's client side initialization javascript
 Hi,I am trying to extend required field validator control. I figured asp.net puts some client side initialization code for each validator as shown below.<script type="text/javascript">//<![CDATA[var RequiredFieldValidator1 = document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1");RequiredFieldValidator1.controltovalidate = "TextBox1";RequiredFieldValidator1.display = "Dynamic";RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";Requir...

Changing Server-Side Control Properties by Client-Side
Hi, I have 4 server side button control. These are for choices of a competition website(A,B,C,D) and I have 1 client side button control named "Changer" on the same page. When I click the Changer I want it to disable A, if it is disabled I want it to disable B... The main question in this topic is "How can I change properties of a server-side control by client-side" My javascript side is not very well. How can I do this? Please help me. I got it guys. Thank You very much.. Hi, Here is the javascript for enable and disable two server side buttons with id Button1 and Butt...

Is it possible to redirect client's browser from the client side?
What I'm getting at is this. My server doesn't have access to certain websites. But my client's browsing my site will have access from the computers they're using. Can my programming logic somehow open up a restricted access site by routing the command to the client's browser and then out on to the web? Or is the best I can do simply putting a hyperlink up that the user can click on? Thanks for any help. To perform any action on the client you will need to consider using a client-side language such as Javascript. You would then be able to do something like document.location('url to re...

How to write data to a file in client side using javascript or someother client side scripting language.
Hi, I would like to know how to write a data to a client side file using javascript or someother client side scripting language. The file type expected is ini file. txt file would also be appreciable. Thanks in advance.   If the site is a trusted and you are running IE then you could try http://www.w3schools.com/asp/asp_ref_filesystem.asp The Old Sewing FactoryThat twitter nonsense. You can write to the server, but not to the client's machine.  Being able to do so would be a huge security breach.When you ask a question, remember to click "mark as answered"...

downloading .NET dll's to client side
hi! does anyone knows how can I download .NET assembly to the client side using the <Object> tag with vesioning? I tried using : <OBJECT id="MyUserControl" style="WIDTH: 1000px; HEIGHT:800px" codeBase="MyUserControl.dll#1,0,0,0" classID="MyUserControl.dll#MyNamespace.MyClass"> </OBJECT> but my MyUserControl.dll assembly is dependent on several other .net dll which should be download indirectly as well. It works fine. The problem arises when I advance the MyUserControl.dll AssemblyVersion (and his dependent dll a...

Accessing GridView's data at client-side Javascript
How can i get the GridView selected row's fields in the Cleint-side Javascript function? Thanks, Riz...

newbie's question,HttpResponse.Cache is server side cache or client side cache?
I mean if i want to cache some client-relate information,can i use the httpresponse.cache? The Cache object is server-side. Client caching is entirely controlled by the user's browser. So, you can only make suggestions to the client-side cache by using things like the Pragma-NoCache header....

Access FileUpload's ContentLength property client-side before postback
I need to validate that the file being uploaded with my ASP.NET FileUpload object is of a certain size before performing postback.  Is this possible?  If so, I can't figure out how to access the file size or content length of the file via Javascript.  Any ideas?  Thanks. I dont see a way to this using javascript unless you used Activex, read the link below http://www.thescripts.com/forum/thread460516.html HCHaissam Abdul MalakMCAD.NET| Blog | HiYou cant get the contentlength of the file before being posted to the server.However, Im assuming your wanting to get the f...

Client-side Dynamic Modification of a ModalPopup's Target Control?
I have a requirement to use ModalPopup type functionality to display a data entry form and, after submission, display a thank you screen. No postbacks should be involved, and the form / screen transition should be seamless. I've done a simple prototype of this using an UpdatePanel and partial rendering, but I'm not 100% happy with it since the URL in the web logs for the partial postbacks would be different for every page from which this form is submitted (the ModalPopup appears from a link that's on every page, via a master page).I'm wondering if the target control of a Moda...

How to Access/Pass Server Side Array Variable at Another Web Form's Client Side
Hi All,I struck up with some intrested senario at my application development...hope some body will guide me or sends me some code snippets....Thanks in advance.Senario is like this.....in A.aspx (using C# .net 2.0 as code behind) I am going to have a array variable basically it is an TWO Dimensional array after populating the values in array I need to redirect/ reload another web form B.aspx, here i need to access the array in B.aspx client side JavaScript.How can I do this...Thanks AgainRaju Dont do a redirect but use server.transfer. That way the previous page will still hold its value, ...

Call client side javascript function for TextBox's OnTextChanged event
I have a ASP:TextBox control in my page. The event OnTextChanged by default is used to call a server side event. I want to define a javascript function on the client site and then the event will call the client side function to set another TextBox control's text instead.Here are some codes in Page_Load() event to register client side javascript:string changeScript = "&lt;script language='javascript'> function SomeValueChanged() {" + "document.getElementById('MonitorChangeControl').Text = 'Some values may have been changed.'; }</script>...

How to restore label's text across postbacks when it is changed by client-side script?
Hello all,I have a page that uses AJAX to check info entered in textboxes and display results by changing the text of labels underneath the textboxes. Since label's value/text is not submitted by the form, I use hidden fields (that are updated together with the labels) to restore the text of labels across postbacks. The question is: is there any nicer way of doing that? Maybe I should use some other control, instead of labels, the value of which is submitted?Thank you.  It depends on what your ajax call is doing.  If it's a webservice call, or any of the ajax framework...

server side variables in client side javascript
I want to use an ASP.net variable in client side javascript.In regular asp I used hidden fields.what is the best way to do this in ASP.NET ?thx,Intersee my blog at www.Interdevelopments.com and check the future of open mobile widget solutions at www.glowe.org By and large, I personally still use Hidden fields to store information, that either my Javascript function or my code-behind use.  I barely use the RegisterScriptBlock method(s) and that is only for situations where I want to be really dynamic with the client side functionality.  95% of the time, I can still use a...

Web resources about - change menu's property Target in client-side (javascript) - asp.net.client-side

Resources last updated: 12/2/2015 6:23:05 AM