|
ASP.Net FAQs/Tips
How Do I Get Framework Version
This can be accomplished veru easily by making use of System.Environment
class. This class has a property named Version. This returns the
version of framework installed on the system. The information is stored in the
following format.
major.minor[.build[.revision]]
The current version of framework is 1.0.3705.0. Therefore
if you call this information and call ToString method on Version
object, you will get the string representation of version information.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
Version vs = Environment.Version;
Response.Write(vs.ToString());
}
}
Is there a limit of 4MB for file upload size?
The answer to this question is yes and no. At runtime, .Net framework checks
the maximum size for the request object. This information is obtained from the
application's condiguration file. If this limit is not specified in web.config
file, then it is obtained from machine.config file. By default
this limit os set to 4096KB.
<httpRuntime executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"/>
To modify this limit, you can change the number in machine.config.
but preferably, create the entry in your application's web.config file.
Set AutoGenerateColumns attribute before DataGrid is databound
When you want to control the columns that DataGrid should render, set the
AutoGenerateColumns attribute to false. If you are using design
time support or directly specifying this value in asp:DataGrid tag,
then it works fine. But if you want to set this attribute value, make sure that
you do it before the control is data bound. Otherwise it will have no effect
and all the data columns will get rendered.
myGrid.AutoGenerateColumns = false;
myGrid.DataSource = CreateMyDataSource();
myGrid.DataBind();
|