Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

How to Set web page resolution according to screen  in asp.net(C#)

I m Working with Web Application
Posted
Updated 16-Oct-11 23:58pm
v2

If you are using Visual Studio then you can simply adjust the anchor property of your form and it's controls and also make use of Dock property. And then whenever you open your webpage, minimize it, maximize it, or resize it, the controls will self-adjust themselves as per your adjustments.

Properties that needs to be changed :-

1. Anchor
2. Dock
 
Share this answer
 
Comments
[no name] 17-Oct-11 5:49am    
I did not understand.

can you write example here .
I am working with Webpage .
It is done in GUI mode in Visual Studio, so following are the examples.

http://www.devx.com/dotnet/Article/6964/1954[^]

This is what we do for windows form, and for web pages there is no such option.

But you can use tables, tr and td or div to setup your webpage. And by managing it via tables or divs, the controls automatically resize themselves when the window is resized.

For eg:-


XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="~/Default.aspx.cs" Inherits="Default" %>

<%@ Register Assembly="BasicFrame.WebControls.BasicDatePicker" Namespace="BasicFrame.WebControls"
    TagPrefix="BDP" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Web Employee Master</title>
    <style type="text/css">
        #form1
        {
            text-align: center;
        }
    </style>
</head>
<body style="background-color: #cc6699">
    <form id="form1" runat="server">
    <table>
        <tr>
            <td>
                <asp:Label ID="lblEmployeeMaster" runat="server" Text="Employee Master" Font-Bold="True"
                    BackColor="#FFFF99" BorderColor="Black" BorderStyle="Dotted" Font-Underline="True"
                    Style="text-align: center" Width="244px" Font-Size="X-Large" Height="28px"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%">
                    <tr>
                        <td align="left">
                            <table>
                                <tr>
                                    <td>
                                        <b>Employee ID :</b>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtEmpID" runat="server" Width="150px" ReadOnly="True" MaxLength="5"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>Employee Name</b> <b>:</b>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtEmpName" runat="server" Width="150px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Must not be Blank."
                                            ControlToValidate="txtEmpName" SetFocusOnError="true"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>


</table>
 
Share this answer
 
v4

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