hi i want to create web page which can not be maximized or minimize
how to create such,, and sometime we can see some advertising page which is fixed so i want to create like that,,
You can't do this. Your web page can't handle the state of the browser. And also you won't able to prevent the zooming of your page.
Simple answer, set the width and the height of every single element?
Using Javascript you can make your page resize itself back to its intended size, but beware for you have no control of a user's viewarea. What this means is that not every client has the ability to display 1240x720 or whatever the case may be in your one-size-fits-all methodology.
You can use something like this within your body tag:
<body onResize="javascript:changeBackTo(800,600)">
And this as a script:
function changeBackTo(myWidth,myHeight) {
window.resizeTo(myWidth,myHeight);
}
Related
I tried using Page.ClientScript.RegisterStartupScript to place HTML or invisible elements at the bottom of my page and this seems to be working fine. Is there anything wrong with this as the RegisterStartupScript was intended for JavaScript only?
<asp:ContentPlaceHolder> is the correct control to use to "place HTML or invisible elements at the bottom of my page"
The problem you'll most likely encounter with this approach is that when using the UpdatePanel, you should be calling ScriptManager.RegisterStartupScript() instead. This will depend on the structure of your page (eg, are you registing the script from within a UserControl), and what your javascript is doing
What you've done is not something to be taken as a best practice, but I believe it should not cause you any problem. What the ScriptManager and the ClientScript do, is just append the specified content to the output HTML that is going to be sent to the browser.
However, you can consider to achieve this by placing place holder control at the bottom of the page and then append your HTML content to that holder.
I've been reading through a few asp.net articles, and attempting some code, but I think I may be confused. Can you or can you not draw lines on the screen with code on a ASP.NET webform using c#?
If so, can anyone direct me to some examples?
You cannot directly draw on a webform. You may draw on the image and then embed it on your webform (like any other image).
You can make a canvas and then you can draw whatever you want to draw on it.But direct drawing is impossible.
If you are fine with HTML5 you can try lineto Javascript method:
<script>
context.lineTo(100, 200);
</script>
Please refer # following link for more details:
http://www.html5canvastutorials.com/tutorials/html5-canvas-lines/
Not sure what you mean by "draw a line" but if you are using a web browser you need some kind of HTML object to display this "line". If all you need is a horizontal line you can just add a HR html tag and use CSS toy stylize it. You can also include this line in an image or HTML5 Canvas.
Because there is not screen for your server side code. Your code generates HTML, JavaScript etc. and then browser uses that content to render it on the client screen. So your options are to generate image (draw all that you need) in server side code and send it to the browser, or you can use JavaScript and send browser instructions how to draw lines.
You could probably create a new image using the System.Drawing namespace classes and then do something like dynamically load it into an <img /> tag...but depending on what you're trying to accomplish it may be far easier to either use a JavaScript library of some sort or to use some sort of very simple line image and tweak the length/height using css.
More detail would be needed to understand what you're trying to do. As others have pointed out though, there's no direct way for your C# code to interact with the page. You'd have to have something on the page like an img tag and then set it's source to a C# file like a handler (.ashx). In that handler you could generate the image and then set the response content type as image/jpg and write the raw bytes to the response stream...
Again though, that seems like overkill for something that could be accomplished with CSS or javascript.
I want to show a web page within another web web in asp.net. I have a page named home.aspx and a page name add.aspx how can i do this.
if you just want to load contenct than make use of jquery ajax function or noraml ajax to load data in you page
Example
$("#result").load("AjaxPages/Page.aspx", function () {
alert("Page.html has been loaded successfully!")
});
Use iframes. Pleace for example this code inside the homep.aspx. This is only the idea, find how to show it with out border and with out scrool bars, and also how to fit it in place.
<iframe src="add.aspx"></iframe>
http://www.w3schools.com/tags/tag_iframe.asp
http://htmlhelp.com/reference/html40/special/iframe.html
ajax and iframe
Use ajax if you have some informations only to show. Use iframe if you also need independend post backs that enters data.
ajax is better if you care to have only one page, not working with out javascript, and maybe you need to add more ajax to make more thinks with the data that you get.
iframe is fast, but 'dirty' because is not seo friendly, a user can open content from iframe alone, etc.
Using C#, ASP.Net
In my webpage i have the link for the another web page, if i click the link that should display a another page inside the main page like child page.
Another webpage should display like a popup window in my webpage. And also size of the another webpage should be small. How to do this.
Need Help.
For displaying one web page within another look at using frames (or an inline frame - iFrame)
The second part of your question I think is asking to be able to display the link in a separate window. To do this, use the target="blank" attribute in the anchor tag. to set the size of the child window you will need to use javascript:
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>
So just call the showPopup method from your anchor click event
link text
Ideally you would move the javascript so that it is no longer inline, but this should work.
For the first part you need a master page
For the second part you might need a modal popup or it's jQuery equivalent
However, I don't understand what you mean with
And also size of the another webpage should be small. How to do this.
Another webpage should display like a
popup window in my webpage. And also
size of the another webpage should be
small. How to do this.
Did you mean a jQuery Modal Window?
I have a situation that I am stuck with, and hoping someone can help. I am building a .NET/C# web application in which I have a tabbed panel layout, and when the user clicks on each of the tabs the display panel is updated using javascript to hide and show some divs. None of these clicks cause postback, it is all client-side, so I can't use viewstate or session.
What I want to do is somehow remember which panel was last visible when the page is refreshed, yet without posting back to the server I am unsure how to do this. I have tried a hidden field but obviously its value is reset every time because the form is never submitted. I do know that I can achieve this using cookies but its a little annoying to implement for such a (seemingly) trivial operation ... but maybe this is the only way?
Does anyone have any more elegant solution to this problem?
Using a function like this to show and hide tabs):
function makeCurrent(tab) {
if (tab.title == 'Manage orders') {
document.getElementById('panelOrders').style.display = "block";
// Hide others
document.getElementById('panelAccounts').style.display = "none";
document.getElementById('panelProducts').style.display = "none";
document.getElementById('panelSettings').style.display = "none";
// Remember last viewed panel
document.getElementById('hdnCurrentlyViewing').value = "orders";
}
The panels are just divs with style.display controlling their visibility. Not sure if its useful to post HTML code because its fairly self explanatory ...?
You can make this happen without a postback is to make an AJAX call from Javascript where you tell your server what the current panel is as you switch it.
I prefer using a framework like JQuery or Prototype to help make these AJAX calls myself.
I think Hidden field will be the best option. have you tried ASP:HiddenField? It can be accessed across postbacks.
But if you still have some reservations with postbacks and hiddenfield you can also use cookies from JS http://techpatterns.com/downloads/javascript_cookies.php this is helper lib for cookies manipulation within JS.
Regards.