Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi
I want to enable and disable link button in asp.net page. i loaded that asp.net page from iframe tag.

That iframe tag embedded in php page.

Have any way access that asp.net page disable linkbutton.

I have used the following code but its of no use any help will be valued the most

'ifrm - id of iframe tag.'
iframe = document.getElementById('ifrm');

'access iframe content, what i loaded inside'
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

'here i want disable link button, which is present that loaded page.'
But giving error
document.getElementById('iframe').parentNode.removeChild(document.getElementById('LinkButton1'));

'above line detail'
LinkButton1 is the ID of button present in that asp.net page.

pls give me a solutions..
Posted

1 solution

In Asp.net page Use

<asp:hyperlink id="HyperLink1" runat="server" visible="<%#CheckVisible()%>" font-size="Medium" target="_blank" xmlns:asp="#unknown"> <%#Eval("HypaerLinkText")%>


and in Code behind form write logic of the showing visibility like

public bool CheckVisible()
{
bool visible=false;

if(a==0) //check your logic here
{
visible=true;

}
return visible;
}
 
Share this answer
 
Comments
hari301 7-Mar-13 11:38am    
that aps.net page not created by myself.. its 3rd party page. then have any other way from access that page.
hari301 7-Mar-13 11:42am    
pls see this link
http://www.codeasp.net/assets/demos/blogs/disable-linkbutton-with-jquery.aspx

In this page contains, linkbutton,disable button & enable button.
if i click the disable button, the link button disabled..

i want like this, while the iframe content load, i need to disable that linkbutton.
nitin bhoyate 7-Mar-13 12:23pm    
Then you need to call the function/code of disable button at time of iframe load

For this you can use iframe onload event

see details here

http://www.w3schools.com/jsref/event_frame_onload.asp
hari301 8-Mar-13 0:25am    
almost i reached.. but i dont know how to select the particular element, which loaded on inside of iframe. can you tell me pls..
nitin bhoyate 9-Mar-13 5:54am    
http://stackoverflow.com/questions/1088544/javascript-get-element-from-within-an-iframe

This link might help you

Plz share your code snippet so that i can look over

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900