Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding and showing iframe 1

Status
Not open for further replies.

arkadia93

Programmer
Oct 19, 2006
110
GB
I am using the tree view IE web control and I need to show different iframes depending upon which node in the tree view has been clicked, and if not have been clicking I don't want any iframe to show.

Can anybody help me out with this? I don't know how to show/hide iframes, and if this would be the right way to go about it.


Thanks
 
If you add runat="server" to any control, you will be able to access it server side.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Great, now how do I make it so that depending upon the node clicking, you view a different page in the iframe?
 
Just change the "src" attribute of the iframe when the user clicks the node. This could either be done server side or by using a javascript solution.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
When I enter the iframe name in my C#, src is not recognised. I can add src in the .aspx page, but not in the C# page
 
I am declaring the iframe as a HTML Generic Control if that makes any difference?
 
You could try adding it via the controls Attributes.Add method


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
What I mean is, if my iframe is called countdetails, how do I use attributes.add to add a different src for the iframe depending upon what node is clicked?

public void TreeView_SelectedIndexChange(object sender, TreeViewSelectEventArgs e)
{
Label1.Text += e.NewNode.ToString() + " (old Node Index=" + e.OldNode.ToString()+")" ;

switch (e.NewNode.ToString())
{
case "0.0":
countdetail.Visible = true;
countdetail.Attributes.Add...
break;

case "0.1":
countdetail.Visible = true;
countdetail.Attributes.Add...
}
}
 
If you ever have trouble with what to pass into a method or property, I suggest reading the help files as there is a file for every method, usually with an explanation and example of how they can be used.

Start by doing this here:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Sorry, I'm still not understanding how attributes.add helps me set the src of an iframe...can anybody help?
 
Well, if you read the help file, it states that it will "add an attribute to a server control's AttributeCollection object."

As "src" is an attribute of an iframe, this seems like it would be a potential solution.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
So it would be like :

countdetail.Attributes.Add("src", "treeview2.aspx");

Apologies, I thought there must be something more to it, I've had problems using Attributes.Add before...


Thanks!
 
Oops, must have missed that!


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top