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?

0
ZLA
4/1/2006 6:31:24 PM
asp.net.client-side 24353 articles. 1 followers. Follow

3 Replies
631 Views

Similar Articles

[PageSpeed] 33

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 output it's client-side ID into a local js variable
 
  
<script type="text/javascript">
var lnk=document.getElementById('<%=LinkButton1.ClientID%>');
</script>

 When opened popup could basically reference the lnk variable like window.opener.lnk (not remembering 100%  if it is lnk or document.lnk, with functions it is straight opener.functionname) and after you have the reference, chaning the text is just using lnk.innerText etc

Just note that changing the text only on client-side, doesn't reflect on server-side, so when you change the LinkButton text in client-side code and have a postback after that. the change is gone.


Thanks,

Teemu Keiski
Finland, EU
0
joteke
4/2/2006 8:09:20 AM
I was under the impression that DOMs weren't accessible as an element. Is that wrong?
0
ZLA
4/2/2006 2:32:34 PM

I don't know what you mean, but what Joteke posted works.

NC...

 

0
NC01
4/2/2006 3:03:14 PM
Reply:

Similar Artilces:

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"...

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... 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,RavikanthPlease "Mark as Answer&q...

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...

How to use client-side script(javascript) in DNA using .Net Remoting
Hi all,     It was known that SAO and Singleton object about .Net Remoting. When I Create an object in server side and hosting in IIS's virtual directory,I want to use javascript asynchronous invoking the remote object by HTTP channel, 80 port and SOAP formatter just like XMLHTTP invoking web service. My code as following, <script> objXmlDoc = new ActiveXObject("Msxml2.DOMDocument"); objHttp = new ActiveXObject("Msxml2.XMLHTTP"); strEnvelope = ?? objHttp.onreadystatechange = function() { ...... }   szUrl = "http://ServerNa...

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...

When to use client side varidation and server side varidation in .net?
In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks! Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.Here are a few references:Validating ASP.NET Server ControlsIntroduction to Validating User Input in Web FormsClient-Side Validation for ASP.NET Server ControlsSecurity Checklist...

Modifications in client side can't be detected in server side.
Hi, I have 2 HTML controls in my page, that run at server, Drop Down List (Copy From), List Box (Copy To), and 1 ASPX button, On the page load i populate the DDL, from database, 3 item added for example. At the end of HTML page, a java script code call a JS function, that function get all items of DDL and remove the selected item, and place the other 2 items in list box, so if i have A, B, C in DDL, and A Selected, the script only place B, and C in the list box. The population of DDL performed in the server side, the population of list box performed in the client side by java scrip...

Can't combine client-side & server-side
I have aspx file (with master page). I need to activate cilent-side vb script function (which is in the aspx) that gets remote IP address and resolve it's hostname. but I'm not able to send the IP' this is my code: <td>document.write(GetHostNameFromIP(<%Request.ServerVariables("REMOTE_ADDR")%>)))</td> can someone tell me what's wrong ? Seems you should write something like: <td><script type="text/vbscript">document.write(GetHostNameFromIP(<%= Request.ServerVariables("REMOTE_ADDR") %>)))</script>...

can clear server side text box value from client side.?
Hi, function Disab() {    if(document.all.chkSPTariff.checked)     {        document.all.txtVFX.disabled=false document.all.txtVHSFO.disabled=false    }  else  {     document.all.txtVFX.disabled=true document.all.txtVFX.value=""               }   This is how i am clearing  the  text for <asp:TextBox>. Ofter i submit, i wonder to see the old value from serverside , like txtTemp.Text is h...

Can you call a c# on the server side from javascript functions on client side
Hello guys This is something intresting I have come across during development. I have a javascript written in a .JS file , to my knowledge the .js files are executed on the server side. But security concerns with java script that these .js files can be access by connecting to port 80 of the server . So an ultimate alternative reminas to call c# code from a java script function. Can anyone Help me on this matter Regards Nihar Hi Nihar, Usually .js files executed on client side. Please explain your configuration.Leon LangleybenMCSD, ASP.NET MVPBlog...

How to change txt2.text when the txt1's.text changes using JavaScript?
Hello! I want some JavaScript (or any other client-side) solution for my problem thatdescribed here:  http://forums.asp.net/p/1382766/2930267.aspx In a few words, my problem is that i don't know the way to change the txt2.text valuewhen the txt1.text value changes... Please read the http://forums.asp.net/p/1382766/2930267.aspx first...I want only JavaScript solution... Thank you very much! Like this? <input type="text" id="TextBox1" name="TextBox1" onchange="textBox1OnChange(this);" runat="server" /><input type...

Change a label backcolor using client-side javascripting
I'm working on a small project where I need to either change the backcolor of a label or change the image on the page. The user will have a list of colors in a dropdown to pick from. I've tried many variations of the code below and nothing seems to have any effect on the label backcolor. Here's what I have: <script type="text/javascript">function Color(elem) {var indx = elem.selectedIndex; var lbl = document.getElementById('<%= label1.ClientID %>');if(indx == null) alert('d_Color not found!'); else {if(indx == 1) lbl.backColor = ...

How to use client-side script(javascript) in .Net Remoting
Hi all,     It was known that SAO and Singleton object about .Net Remoting. When I Create an object in server side and hosting in IIS's virtual directory,I want to use javascript asynchronous invoking the remote object by HTTP channel, 80 port and SOAP formatter just like XMLHTTP invoking web service. My code as following, <script>  objXmlDoc = new ActiveXObject("Msxml2.DOMDocument"); objHttp = new ActiveXObject("Msxml2.XMLHTTP"); strEnvelope = ?? objHttp.onreadystatechange = function() { ......  }    szUrl = &...

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...

Web resources about - Can you change a linkbutton's text using client side javascript? - asp.net.client-side

Resources last updated: 1/11/2016 10:51:40 PM