iframe tag in asp.net - asp.net-2.0

I am using an iframe tag in my asp.net page. When I place any other controls in that
page, after running the page except iframe tag no other controls displaying in that page.

Make sure you have closing tag for the iframe, it should be like this:
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Before Iframe" /> <br />
<iframe src="http://google.com"></iframe><br />
<asp:Button ID="Button2"
runat="server" Text="After Iframe" />
</div>
</form>

Are You putting your controls inside the iframe tag? Content You put over there will only be shown by (really) old browsers that don't support iframes. You need to make a second page and have the iframe load it (src attribute)
If the controls are outside the iframe, it should work fine. If it isn't, there must be a problem with the markup, like unclosed tags.
Example:
<form id="form1" runat="server">
<asp:Literal ID="Literal1" runat="server">Outside IFRAME</asp:Literal><br />
<iframe src="OtherPage.aspx">
Your browser does not support IFRAMEs.
</iframe><br />
<asp:Literal ID="Literal2" runat="server">Outside IFRAME</asp:Literal>
</form>

Related

What happens when an update panel doesn't have any triggers?

I have the markup below, there is no triggers section and no setting of the triggers in the code behind. When I click on the checkbox, the page does update and show the hidden div (server side code sets visible), but page loading spinner in the page tab doesn't spin in chrome. If I remove the update and template tags, the page seems to act the same except that the page loading spinner spins.
What is actually happening? Is the page being reloaded or not? If the update panel is loading the page, why is it doing so without a defined AsyncPostBackTrigger?
<asp:UpdatePanel runat="server" ID="pnlMain">
<ContentTemplate>
<div class="control-group">
Hide Div
<div class="controls">
<asp:CheckBox ID="chkbx" CssClass="Input" runat="server" AutoPostBack="true" />
</div>
</div>
<div id="divToHide" runat="server">
stuff to hide when div is clicked
</div>
<div class="form-actions">
<asp:LinkButton ID="btnSubmit" runat="server" Text="Submit" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
Page is loaded in both cases. With Update Panel only Partial Page(Content inside the Content Template is updated) whereas in normal case entire page is re-rendered.

chrome automatically set focus on a textbox

I have an aspx form which contains couple of textboxes, dropdownlists and checkboxes on it. I have not set the default focus on any of the control. When I open this in IE it works fine. but when the page opens in chrome it set focus on a textbox which is not the first element of the DOM. and when the page opens in FireFox, it set focus on first textbox in the DOM.
I don't want focus on any of the control, how can I fix this issue.
Can you try document.getElementById('yourElement').blur();?
You could add autofocus = false;
<input type="text" name="second" id="second" "autofocus = false" />
Take look at these links:
http://msdn.microsoft.com/en-us/library/ms178231(v=vs.100).aspx
or
http://msdn.microsoft.com/en-us/library/ms178232(v=vs.100).aspx
Maybe it can help you.
Try setting default focus on from in aspx like this:
<form id="form1" runat="server" defaultfocus="TextBox1" >
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />
</div>
</form>
Post your code for more informations.
re: I think that you must have focus on at least one control on page. You can set dummy control like input and set it's opacity in css to 0 and set defaultfocus on it.

Multilingual web application change div text?

I am working with asp.net web application multilingual site.
I am using following link :
http://techaxe.com/2010/09/04/creating-multilingual-website-using-asp-net/
Here we have file in my App_LocalResource folder for change text content. It's work good with label control.
<asp:Label ID="Label1" runat="server" Text="<%$Resources:AboutText%>"></asp:Label>
Here I want to change my div content as per selected language.
<div class="registration_content" runat="server">
<%$Resources:AboutText%> </div>
Please suggest me how I can change div content as per local resource variable.
Thanks for any suggestion..
You could use an asp:Literal tag:
<div class="registration_content" runat="server">
<asp:Literal runat="server" Text="<%$Resources:AboutText%>" />
</div>

IE not catching Enter key for form submission

I have a simple form with one text box that pass data to SQL and I want it to submit when the user hits the enter key.
In Firefox, this works great. The user puts a number hits enter gets back the results.
However in IE 8 and IE 9 this is not working.
<form id="form1" runat="server" accept="cmdclick"
style="background-position: center; background-image: url('BG.gif'); background-repeat: no-repeat;">
<div style="text-align: center">
<br /><br /> <br /><br /><br /> <br /><br /><br />
<asp:TextBox ID="txttrack" runat="server" Height="20px"
Width="175px" Wrap="False"></asp:TextBox>
<asp:Button ID="cmdclick" runat="server"
CommandName="cmdclick" BackColor="White" BorderStyle="None" />
I am not sure what would cause this. I see a lot of people using JavaScript to go around the problem however I do not know how to write JavaScript code.
How can this be done (preferably without JavaScript)?
Set the DefaultButton-Property in Form-Tag:
<form defaultbutton="cmdclick" runat="server">
You can also set the DefaultButton on ASP.NET-Panels. This might not be important in this case but
when you're using MasterPages, because the ID of a Button in a ContentPage is unknown in a MasterPage (Form-Tag is inside the Masterpage)
when you want to have more than one DefaultButton you can set different DefaultButtons to every Panel
If you have recursive form elements (which is against standards compliance) then IE will basically ignore the enter key and not submit the form when it is detected as it doesn't know which form you are trying to submit.

Rating control not appearing

I am trying to use the ASP.NET ajax rating control on my ASP.NET website. I have followed the exact steps from the video tutorial to use this rating control.
Here's my HTML code.
<div id="Rating" style="float:right; width:400px">
<div class="demoheading">Rating demonstration
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="float:left;width:230px">
How much do you like this profile?
</div><br />
<asp:Rating ID="LikeRating" runat="server" CurrentRating="3" MaxRating="5"
StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyStarRating"
style="float:left" onchanged="LikeRating_Changed1" Height="40px"
Width="400px">
</asp:Rating><br />
<div style="clear:left;">
<asp:Button ID="ButtonSubmit" runat="server" Text="Submit" />
<asp:Label ID="LabelResponse" runat="server" Text="[No response provided yet]"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br /><br />
</div>
</div>
My rating control is not appearing in the designer. However, when I hover that blank space it should be, it shows me the rating number as in the figure below. I did check the path of the images and the css I used for the star rating. Is there still something I am missing?
You do not have the proper path to your image or the images do not exist. The control is there, the styles that you declare for the different type of stars do not have the images.
Also, you are missing a semicolon here:
emptyStarCssClass="emptyStarRating"
style="float:left"
should be
emptyStarCssClass="emptyStarRating"
style="float: left;"
I would recommend inspecting the element to check what it shows the image path is.
I missed the in designer part. I have experienced some issues where designer does not quite understand the image paths and will flag the path as bad, but in actuality it is fine. Have you tested the page in debug mode?

Resources