Saturday, October 23, 2004
Default Button for a TextBox (Data entry screen) in ASP.NET
When you press a key on your keyboard, the js OnKeyPress event is fired. This calls a function to which we pass the id of the button associated with the TextBox. The function gets a reference to the button and simuilates a mouse-click on the Button. We perform a browser detection because IE and Netscape have different event models. The function finally returns false so that the keypress event is cancelled (otherwise a second form submit will be raised). I tried this code with newer versions of IE 6.0/Netscape 7 it worked great!.
//client side js
function clickButton(e, buttonid){
var bt = document.getElementById(buttonid);
if (typeof bt == 'object'){
if(navigator.appName.indexOf("Netscape")>(-1)){
if (e.keyCode == 13){
bt.click();
return false;
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
if (event.keyCode == 13){
bt.click();
return false;
}
}
}
}
//code behind
TextBox1.Attributes.Add("onkeypress", "return clickButton(event,'" + Button1.ClientID + "')");
The code behind generates the following code:
< input name="TextBox1" type="text" id="TextBox1" onkeypress="return clickButton(event,'Button1')" / >
This causes web control Button1 to be clicked when the enter key is hit inside TextBox1.
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Adding Cross-Site Scripting Protection to ASP.NET 1.0
Check out the article @
http://msdn.microsoft.com/library/en-us/dnaspp/html/ScriptingProtection.asp
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Multilingual Support in .NET
This tutorial will teach you
- How to create the Resource files for various languages.
- How to access the Resource file data from the web pages.
- How to store Unicode (multilingual) data into the database.
- How to access multilingual data from the database.
You can find the tutorial article at http://www.developersdex.com/gurus/articles/500.asp?Page=1
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Better Ways to Manage Your Cache in ASP.NET
Read more here http://www.devx.com/asp/Article/21751/1954?pf=true
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Tuesday, September 28, 2004
Web Forms DataGrid and DataSet Programming
Get more here http://www.developerfusion.com/scripts/print.aspx?id=3801
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
How server form post-back works?
When a control is declared to run on the server, a VIEWSTATE is created which remembers the ID of that control, and the method to call when an action is performed. Submit event calls the JavaScript function __doPostBack (that's 2 underscore symbols in front of it). You do not write this function, instead it is generated by the ASP.NET engine and automatically included in our page. It submits the form to the same page, and accepts 2 arguments:
eventTarget: the control doing the submission
eventArgument: any additional information for the event
At least one control needs to be set to Visible, for the server to generate the __doPostBack function in our page. Even if we have numerous web controls declared to run on the server, but they are all set to Visible=false, then the javascript function will not be included and we will not be able to perform any actions.
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
How is the viewstate encoded? Is it encrypted?
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Do we HAVE TO name the ASP.NET configuration file as web.config?
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
How do we handle session across ASP and ASP.NET pages in the same Site?
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Asynchronous Programming in Web Services
services... We will get into details of this topic sometime but now just an
overview...
A client calls the Begin method on the server object and passes a reference
to the callback method... The asynchronous method on the server object
finishes execution and gives a call back to the method on the client
object... This method in client object now causes the call to End method on
the server object.... The End Method then returns the result to the
client...
Well why would you do such a thing??... The simple reason can be when your
server side execution is really going to take long and you do not want to
wait for all that processing to happen...
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Tuesday, September 21, 2004
Top questions about Datagrid
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
This paper addresses some of the questions about customizing grid display that are commonly asked in newsgroups, on Web sites, and in other developer forums.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp
Q) When I try to do an Update from my Datagrid, I keep getting the old/original values. Why?
This is caused by calling DataBind() on the grid before retrieving the updated values. The DataBind() overwrites the updates with the original values. Usually caused by having the initial DataBind() of the grid called on every Page_Load. Solution: call DataBind() only the first time the page is loaded:
Sub Page_Load(s As Object, e As EventArgs)
If Not IsPostBack Then BindGrid()
End Sub
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
How do I specify more than one parameter for my HyperlinkColumn?
Note: You should always encode values passed into querystring to protect against spaces and special characters.
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
ASP.NET State Management Overview
However, it is very useful to maintain state across requests for certain solutions. ASP.NET enables you to maintain both application state and session state through use of application and session variables respectively.
Learn more about
Application State
Session State
Configuring Session State
here - http://support.microsoft.com/default.aspx?scid=kb;en-us;307598&Product=aspnet
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
ASP.NET Page Framework Overview
Learn more about
Page Life Cycle
Page Events
Page Directives
Inline Versus Code-Behind Programming Models
here - http://support.microsoft.com/default.aspx?scid=kb;en-us;305141&Product=aspnet
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
How to use Response.Redirect in C# .NET
Use HttpResponse.Redirect
HttpResponse Class
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpResponseClassTopic.asp
HttpResponse.Redirect Method
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassredirecttopic.asp
HttpResponse.BufferOutput Property
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclassbufferoutputtopic.asp
More here...
http://support.microsoft.com/default.aspx?scid=kb;en-us;307903#7
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Common Request: Which Data Control should I use?
Learn about ASP.NET's three controls for displaying data: the DataGrid, the DataList, and the Repeater. Each of these controls has unique traits and associated advantages and disadvantages. When creating an ASP.NET application that displays data, it is important to choose the right control for the job.
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/aspnet-whenusedatawebcontrols.asp
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Wednesday, September 01, 2004
Building Custom Controls with ASP.NET
* http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondevelopingwebformscontrols.asp
# ASP.NET Server Control Samples (short demonstrations of server control authoring tasks)
* http://msdn.microsoft.com/library/en-us/cpguide/html/cpconservercontrolssamples.asp
# Microsoft® ASP.NET QuickStarts Tutorial – Authoring Custom Controls
* http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Compilation
Machine boots.
Request for MyPage.aspx comes in (first time).
MyPage.aspx compiles to an assembly* (we'll call it MyPage.dll* ).
The portions of MyPage.dll that are needed for execution are JITed* to memory.*
Page execution completes. The JITed code stays in memory.
A new request for MyPage.aspx comes in. The page hasn't changed. The JITed code that is still in memory runs.
The source for MyPage.aspx changes.
A new request for MyPage.aspx comes in. MyPage.aspx compiles to an assembly, JITs, and executes. The JITed code stays in memory.
A new request for MyPage.aspx comes in. The page hasn't changed. The JITed code that is still in memory runs.
IIS is stopped and started.
A new request for MyPage.aspx comes in. The page hasn't changed. Because IIS was stopped and started, the JITed code is no longer in memory. The existing MyPage.dll JITs and executes. This new JITed code stays in memory.
The JITing process is similar with any .NET code, including .DLL's in your ASP.NET application and .DLL's and .EXE's in WinForms applications. Since there's no page, and since the assembly is already created, these steps don't take place. Instead, methods in the assembly are JITed to native code in memory when they're called (step 4 above), and unloaded from memory when the calling application (the Windows .EXE, or IIS and the ASP.NET worker process as in step 10 above) is closed.
Please Note:
Step 3: Note that a code file (.CS for C# code, .VB for Visual Basic code or no code) gets created from the .ASPX page first, then this file gets compiled into an assembly (.DLL).
Step 3: The MyPage.dll assembly won't have a friendly name like that. Expect more like "yxgq4-hz.dll". Whatever it's called, it will be under a directory called something like "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files".
Step 4: "JITed" is shorthand for "just-in-time compiled." In .NET, methods from your assemblies are compiled into native binary code when they are called. In ASP.NET, this happens when pages are requested by the web browser--at runtime, and thus, just in time before serving the response. Contrast this with COM components, which must be compiled to binary code ahead of time, before they can be called.
Step 4: This is just a one-time performance hit, and even so, it shouldn't be of concern. In Scott Guthrie's words: "Note that in practice, the cost of dynamic JITing the first access of a page's code is minimal. Because most of the overall page code path actually lives within [.NET] Framework libraries (for example: the code within the page base class, the code within System.Data, System.XML, etc.), the number of instructions generated from your actual code are pretty minimal. Because we can dynamically JIT millions of instructions to native code per second, this one-time cost ends up being noise in the grand scheme of things."
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
ASP.NET Page Execution
Here's a short exercise that will help you internalize what is happening during the creation and execution of a page. Do this without looking up the answer, and it will really make you think through what is happening. Put the following events in order, assuming the request is a PostBack resulting from a Button click:
Unload
Pre-Render
Handle Postback Events
Dispose
Save State
Load View State
Load
Button Click Handler
Process Postback Data
Initialize
Send Postback Change Notifications
Render
You can lookup the answer in MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcontrolexecutionlifecycle.asp, but realize that at least one of the events is out of order in the documentation.
Consider the events in your Global.asax class on the first request received by an application not yet started:
Authorize Request
Application Start
Authenticate Request
End Request
Page Execution
Begin Request
Session Start
The next time you try to access ViewState during the Init event, you'll know why it doesn't work correctly.
With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Maintaining State Across ASP.Net Pages
1) Using QueryString : You can pass values of one page to another page using Query strings... This is an old ASP custom but for security reason not always recomended in ASP.Net
2) Using Session : You can also pass values of one page to another by storing them in session... Use of session is pretty simple and we have discussed that earlier as well (Click Here)... But do understand the fact that Session variables are to store user specific information which is unique to each user and not each page... Also do note that if you forget to clean the session variables in the next page you might land up increasing the session size like anything effecting performance of your application...
Other Advance Methods Are :
3.) Using HttpContext/RequestParams with Server.Transfer: We discussed adding to session yesterday, similarly you can add to HttpContext as well and this eliminates the cleaning code required in the next page like the way it is required in Session... There are other advantages too...
If you use Server.Transfer then all your control values are automatically transferred to the next page you do not have to add anything to the context explicitly here rather just access the values in the coming page... The code example will show this more clearly...
If you have certain values other than the above mentioned then you have to do certain special operations to explicitly add them in the first page and retrieve them in the second...
CODE SNIPPET
FirstPage Code:
//These are the special values being added to context
//we will retrieve them in the next page
context.Items.Add("specialVariableName", "specialVariableValue");
//We set the second parameter of Server.Transfer to True this will help
//sending certain values automatically
Server.Transfer("NextPage.aspx", True);
NextPage Code:
string strValueOfFirstPageTextBox;
string strSpeciallyAddedValue;
//Use Request.Params to get values of the standard variables
//which get automatically transferred
strValueOfFirstPageTextBox = Request.Params.Get("firstPageTextBox")
//Use HttpContext to get the values specially added
strSpeciallyAddedValue = context.Items("specialVariableName")
4.) Using Properties with Server.Transfer: Make your first page in such a way that you expose the required values in next page as properties in the first page... Then use Server.Transfer to go to the next page(keep the second parameter as false here, WHY SO WE WILL TALK TOMORROW)... Now in the next page using context handler you can get all the properties of the first page...
I am not writing the first page code as it is just simply adding values into properties and calling Server.Transfer and I believe you all know how to do that...
CODE SNIPPET
NextPage Code:
if(Context.Handler != null)
{
string strInternalVariableOfNextPage;
FirstPage objFirstPage = new FirstPage();
objFirstPage = (FirstPage)Context.Handler;
//Note that SomeValue is a public property of First Page
strInternalVariableOfNextPage = objFirstPage.SomeValue;
}
Friday, August 27, 2004
Inside IIS and ASP.NET
http://theserverside.net/articles/showarticle.tss?id=IIS_ASP
Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
Tuesday, August 24, 2004
Script Debugging Tips
A few quick highlights:
o Internet explorer defaults to having script debugging disabled. IE also likes to disable script debugging when you install a new version of IE (example: XP SP2). In IE, go to Tools->Internet Options->Advanced. Prior to Windows XP SP2, the option you needed to uncheck was 'Disable Script Debugging'. In XP SP2, the IE team decided to split this into two separate options - 'Disable Script Debugging (Internet Explorer)' and 'Disable Script Debugging (Other)'. The 'Other' option control script debugging in other applications that use mshtml.dll such as Outlook.
o Try to keep all of your script running in the same script block. IE will sometimes get confused if you have more then one.
o To debug client side script that is in a .ASPX file, you will need to either open the ASPX file from the Running Documents window (called the 'Script Documents' window in Visual Studio 2005), or set a breakpoint by function name (Ctrl-B).
With Best Regards
Mitesh V. Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Wednesday, August 11, 2004
Asp.net:Delegates and events
Asp.net:Delegates and events
NET, defines a delegate as a class that holds a reference to a method
oEssentially a typesafe callback method reference (pointer)In Vb.NET you can define delegate as
Public
Delegate Sub MyCallbackHandler(x as integer)
The signature of the
delegate defines the signature of the methods it can call. For example, the
MyCallbackHandler delegate shown above can be used to refer to void methods that
take a single integer as a parameter:Delegate Tutorial: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkDelegatesTutorial.aspand Events are declared as
Public Event
MyCallbackEvent As MyCallbackHandlerEvents can be used to inform an object that
something significant has happened, and interrupt the flow of control in that
object causing it to execute a method designed for handling the event. An event
provides a component with a hook that an interested client can attach one of its
methods to. When the component wants to indicate that something significant has
happened, it can raise the event and consequently call the associated
methodsEvents are closely related to delegates, and rely
on the functionality of multicast delegates for registering methods to be called
when an event is raisedEvents Tutorial : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkEventsTutorial.aspRegards,Mitesh v. Mehta
Design Days: View State Performance Tips
Design Days: View State Performance Tips
In controls like listbox controls, items added to the list are carried
between client and server via view state... When the list of items become
considerably large it starts hitting the performance and increasing the
traffic between client and server... To avoid this set the EnableViewState
property of the control to be false... By this unnecessary data will not
move back and forth to the server... Though, do note that by doing so your
selected items will no longer remain selected after postback and you will
have to write special code to achieve this functionality...
The same problems are also faced in controls like Datagrid so do ensure that
you use View State judiciously and give enough thoughts while designing your
application...
To see the view state of a page right click on displayed page and 'view
source', here you will see a long line of junk characters for __VIEWSTATE
property... This is the encrypted view state of your controls... Well, that
makes me add one more point the performance... All the viewstate data that
passes to and comes back from server goes through the cycles of encryption
and decryption which in itself is also a costly affair hitting
performance...
Regards,Mitesh v. Mehta
ASP.Net Server Controls Categories
ASP.Net Server Controls Categories
ASP.Net Server Control can be broadly classified into 4 categories...
1. Intrinsic Controls -These controls correspond to their HTML
counterpart... eg Textbox control, Button control
2. Data-Centric Controls - These controls are used for data display,
binding, modification purposes... They bind to various data sources... e.g..
DataGrid control
3. RichControls - Usually do not have HTML counterparts... These are
usually composite controls which in themselves contain other controls...
e.g. Calendar control
4. Validation Controls - As the name suggest they are used for
validation purposes and can validate many type of user inputs.... e.g.
RegularExpressionValidator
Mitesh Mehta
miteshvmehta@gmail.com
Numeric TextBox - A Simple Way!
Numeric TextBox - A Simple Way!
One of my site visitor ask me a query that he
wants Numeric TextBox in Asp.NET, i suggested him to use javascript but he was
haveing problem on how to write it in javascirpt. i send him this
codefunction IsNumeric(e)
{
if (isNaN(e.value) == true)
{
alert("VALUE SHOULD BE
NUMERIC");
e.value =
"";
e.focus();
return
false;
}
else
return true;
}
<INPUT
type="text" name="amount" onkeyup="return IsNumeric(this)">but then i thought can't we do that in a
simple one line. the thought lead me to Investigate
and i found one can use RegEX to do the same in ONE Line...<INPUT type="text" name="decimal"
onkeyup='this.value=this.value.replace(/[^\d]*/gi,"");' />
Regards,Mitesh v. Mehta
Web Services
some questions
Still wondering how to get your web server to talk to your client over the internet, eh ? :)My answers follow:1.
Being the richest of platforms, the Microsoft platform is not
constrained to just .net or vb for consuming web services. You have the
choice of going for Java which is very capable in the webservices
realm. Then, there is SOAPLite with Perl. Python also has similar
features. Then you can have a browser based client which can consume a
webservice, which you can very well see with ASP.NET webservices, as
the browser on the server machine can act as a client. Now, how are all
these possible brings me to answer question number 2.2.
Webservices are just a means of having a client consume a service being
exposed on the webserver. While standardizing it, the standards body
went in for an XML based protocol, somewhat akin to XML RPC. To present
a simple outlook of SOAP, the comm. on the internet happens using HTTP.
How would one create a standard means of invoking anything across the
web? The answer, encapsulate the HTTP calls in an XML Structure and
name that structure 'SOAP' and write some proxies and stubs on either
side of the comm. channel. Thats all there is to it. Now, in .NET when
we say ASP.NET webservices, a simple way to consume it is to use SOAP,
and this step is made simple by using Visual Studio. But, having an
ASP.NET webservice in no way undermines your ability to invoke this
webservice from a Linux box with a Perl/SOAPLite -- because its
"Standard." Then there is XML-RPC which you can use. And, then there
are the rest.. err. I mean "REST". For more info on these you could try
these websites.3. To measure execution speed of your component, there are a couple of approachesa.
Write to log files with the date/time stamp and then using a simple
vbscript open the log file and parse the times, and draw graphs or
whatever. To make it more persistent, log it to a database. Could
consider MSDE here.b. You can expose the relevant data as
performance counters and this can be read using the tool "perfmon.exe"
(under WinNT/2K/XP). Again, .NET makes it a breeze to provide/consume
Performance counters in your code.4. Already answered in the other replies5.
Just a reminder, in case you are looking for a status/progress kind of
animation, you might want to check out the AVI files in the "graphics"
folder in your VB installation. The samples folder also contains a
sample project which makes use of these videos.In case these explanations just increase your questions, fire away,Regards,Mitesh Mehta
Editable dropdown list box
Editable dropdown list box
An
"editable drop-down list" or a combo-box per se is not supported by any
browser, at least not by IE and Netscape. So having this type of
control is not possible. However, what could be done is to use a
textbox along with a drop-down list and add the contents of the textbox
to the drop-down when the TextChanged event of the textbox fires.
Here's how:Technique 1:Using client-side code (note that asp.net controls can also be used here)<script>function addToCombo(val, obj){if(val.length > 0){obj.options.add(new Option(val));}}</script><input type=text name="txtCombo" onchange="addToCombo(this.value, this.form.selCombo)"><br><select name="selCombo"></select>Technique 2:Using code-behind (C#)<asp:TextBox id="txtCombo" runat="Server"/><br><asp:dropdownlist id="selCombo" runat="Server"/>code behind:private void txtCombo_TextChanged(...){if(txtCombo.Text.Trim().Length > 0){selCombo.Items.Add(new ListItem(txtCombo.Text));}}
Monday, July 26, 2004
manipulating drop-downs in template column of datagrid
Copy the following between the tags of the aspx page in HTML view.
Copy the following in the Page_Load method in code-behind or
between the tags
private void Page_Load(object sender, System.EventArgs e)
{
DataTable dt = new DataTable();
DataRow dr;
DropDownList ddl;
int i;
//Create the datasource for the datagrid
dt.Columns.Add("col1", Type.GetType("System.String"));
for(i = 0; i < 5; i++)
{
dr = dt.NewRow();
dr[0] = i.ToString();
dt.Rows.Add(dr);
}
//bind datasource to the datagrid
dgtest.DataSource = dt;
dgtest.DataBind();
//manipulate the drop-down list of each row of the datagrid.
//this code simply displays the ID as the sole element of the drop-down.
for(i = 0; i < dgtest.Items.Count; i++)
{
ddl = (DropDownList)dgtest.Items[i].FindControl("ddltest");
if(ddl != null)
{
ddl.Items.Clear();
ddl.Items.Add(i.ToString());
}
}
}
output:
ID ¦
-------------------
0 ¦ | 0 |v|
1 ¦ | 1 |v|
2 ¦ | 2 |v|
3 ¦ | 3 |v|
4 ¦ | 4 |v|
Server.Transfer VS Response.Redirect
Server.Transfer VS Response.Redirect
Server.Transfer is often a
better choice than Response.Redirect.Example: Let's say
you're on A.aspx and you want to send the user to B.aspx.Response.Redirect
flow
A.aspx calls Response.Redirect("B.aspx",false); which sends a 302 redirect
header down to the client browser, telling it that the asset it has requested
(A.aspx) has moved to B.aspx, and the web application terminates. The client
browser then sends a request to the webserver for B.aspx. IIS tells asp_wp.exe
to process the request. asp_wp.exe (after checking authentication and doing all
the other setup stuff it needs to do when a new request comes in) instantiates
the appropriate class for B.aspx, processes the request, sends the result to the
browser, and shuts down.Server.Transfer
flow
A.aspx calls Server.Transfer("B.aspx");. ASP.NET
instantiates the appropriate class for B.aspx, processes the request, sends the
result to the browser, and shuts down.Note that Server.Transfer
cuts the load on the client and the server.
Server.Transfer is easier to
code for, too, since you maintain your state. Information can be passed through
the HTTP Context object between the pages, eliminating the need to pass
information in the querystring or reload it from the database.More info http://dotnetjunkies.com/WebLog/familjones/archive/2004/04/08/11020.aspx and http://www.eggheadcafe.com/articles/20030531.asp.
Regards,
Mitesh Mehta
Microsoft Certified Professional
Direct Information Pvt. Ltd.,
How to create pie charts in web applns
Pie Chart in ASP.net
Mitesh Mehta |
How to create pie charts in web applns
SVG : Scalable Vector Graphics is an exciting new XML-based language for Web graphics from the World Wide Web Consortium (W3C). For more info on SVG you can visit Adobe's SVG Zone. VML : Vector Markup Language is an application of Extensible Markup Language (XML) 1.0
which defines a format for the encoding of vector information together with additional markup to describe how that information may be displayed and edited. For more info on VML please check out W3.org's VML Specification. regards Mitesh Mehta Microsoft Certified Professional |
Friday, July 23, 2004
Session State in ASP.Net
Session State in ASP.Net
Session State in ASP.Net
ASP.Net supports three different providers for Session State...
They are:
InProc - Session values are kept live in the memory of ASP.Net worker process
StateServer - Session values are serialized to store in the memory of a
separate process i.e. aspnet_state.exe
SQLServer - Session values are stored on SQL Server...
Mitesh Mehta
Microsoft Certified Professional
Mail : miteshvmehta@gmail.com
C# FAQ
C# Code
SQL Server 2005
VB.NET 2005
ASP.NET Help
mode="SQLServer" for sessionState
When you choose your sessionState to be SQLServer, ASP.Net uses the default
DB and initial catalogs for storing your session information into
SQLServer... That is the reason you are not allowed to pass tokens such as
Database and Initial Catalog in the connection string... Finally your entry
in the web.config file will look like
<configuration>
<system.web>
<sessionState
mode="SQLServer"
sqlConnectionString="server=127.0.0.1;uid=<user
id>;pwd<password>" />
</system.web>
</configuration>
user id and password can be replaced by integrated security settings...
Mitesh Mehta
Microsoft Certified Professional
Thursday, July 22, 2004
Changes to Validation Controls in ASP.NET 2.0
Changes to Validation Controls in ASP.NET 2.0
While ASP.NET 1.x supported validating user input, ASP.NET 2.0 increases
the flexibility of the validation through the addition of validation groups.
This article looks at this new feature, and shows you how you can use it in a
number of common scenarios.http://msdn.microsoft.com/asp.net/whidbey/default.aspx?pull=/library/en-us/dnvs05/html/ValGroups.aspRegards,
Mitesh Mehta
Microsoft Certified Professional
miteshvmehta@gmail.com
ASP.NET 2.0 Custom Controls
ASP.NET 2.0 Custom Controls
Creating ASP.NET 2.0 Custom Controls
Summary: The new adaptive rendering model in ASP.NET 2.0
provides a number of new options for control writers. This article shows how
those options make creating custom controls for ASP.NET easier than
before.
Personalization with ASP.NET 2.0
Personalization with ASP.NET 2.0
Personalizing a Web site has always involved a large amount of complex
supporting code. With the new personalization features in ASP.NET 2.0, however,
developers can not only create personalized applications faster, they can also
build entirely new classes of applications. The user management system and login
controls make recognizing a user even easier than before, and the profile
features help store user data in a fast and efficient manner. The Web Parts
framework, however, provides a revolutionary new design paradigm for Web sites.
Thanks to Web Parts, a Web site is no longer constrained to the linear document
format that formed the basis for the HTML standard. Web Parts offer much greater
flexibility, and allow developers to create Web applications that are almost
indistinguishable from the most powerful desktop systems.
Read More...
Regards,
Mitesh Mehta
Visual Studio for WebService Development - Free!
Visual Studio for WebService Development - Free!
You might have noticed but
again, the recently announced
Visual Studio 2005 Express Beta
allows doing Web Service development. Download the Visual Web Developer
2005 Express Edition Beta and one of the types of projects you
can create is a Web service project.
Here's the default C# Web
service project:
using
System.Web;
using System.Web.Services;
using
System.Web.Services.Protocols;
[WebServiceBinding(ConformanceClaims=WsiClaims.BP10,
EmitConformanceClaims = true)]
public class Service :
System.Web.Services.WebService {
[WebMethod]
public
string HelloWorld() {
return "Hello World";
}
}
You can even use Visual Basic
or C++.
Saturday, July 17, 2004
WSE 2.0 - What's New and Different in WSE 2.0?
WSE 2.0 - What's New and Different in WSE 2.0?
Web Services Enhancements
for Microsoft .NET version 2.0 includes a number of enhancements over earlier
versions of WSE like:Policy
WS-Trust and
Security Context Tokens
Kerberos Security Tokens
Role-based Security Using
Security Tokens
Signing and Encrypting Security Tokens
SOAP
Messaging
XML Security Token Support
To read more on WSE 2.0
Enhancement features go to ->
Regards,
Mitesh Mehta
M.C.P.miteshvmehta@gmail.com
New data source components in ASP.NET 2.0
New data source components in ASP.NET 2.0
This article discusses:http://msdn.microsoft.com/data/archive/default.aspx?pull=/msdnmag/issues/04/06/aspnet20data/default.aspx
New
data source components in ASP.NET 2.0
Binding to business objects and XML
data
GridView and DetailsView controlsSummary:
Data source controls make codeless binding
possible, but seldom practical in real-world situations. Some code must always
be written to fine tune the page, but data source controls significantly reduce
the quantity. Data source controls also integrate caching capabilities and allow
you to enable caching declaratively. Everything happens behind the scenes so you
can deliver best-practice code with almost no effort.Data source controls enable a consistent model across a variety of data
sources. You can use the same data-binding model regardless of whether the data
source is a SQL table, an XML document, a business object, a site map, or even
an Excel worksheet. The new architecture is more automatic in nature, but works
side-by-side with the old model based on enumerable objects.Regards,
Mitesh V. Mehta
Microsoft Certified Professionalmiteshvmehta@gmail.com
Friday, July 16, 2004
New data source components in ASP.NET 2.0
New data source components in ASP.NET 2.0
This article discusses:
New
data source components in ASP.NET 2.0
Binding to business objects and XML
data
GridView and DetailsView controlsSummary:
Data source controls make codeless binding
possible, but seldom practical in real-world situations. Some code must always
be written to fine tune the page, but data source controls significantly reduce
the quantity. Data source controls also integrate caching capabilities and allow
you to enable caching declaratively. Everything happens behind the scenes so you
can deliver best-practice code with almost no effort.Data source controls enable a consistent model across a variety of data
sources. You can use the same data-binding model regardless of whether the data
source is a SQL table, an XML document, a business object, a site map, or even
an Excel worksheet. The new architecture is more automatic in nature, but works
side-by-side with the old model based on enumerable objects.Regards,
Mitesh V. Mehta
Microsoft Certified Professionalmiteshvmehta@gmail.com
Monday, July 12, 2004
Article: Improved Caching in ASP.NET
Article: Improved Caching in ASP.NET
New caching feature
included in ASP.NET 2.0, improves the performance and scalability of ASP.NET
applications. The ASP.NET 2.0 framework includes a number of significant new
enhancements that make it easier to take advantage of caching in
applications.The new DataSource
controls include properties that make it easy to cache database data in memory.
By taking advantage of the DataSource controls, database data can be
retrieved and cached without writing a single line of code.The new support for SQL Cache
Invalidation enables to automatically reload database data in the cache whenever
the data is modified in the underlying database. This feature provides all the
performance benefits of caching, without the worries of stale data.Finally, the new
Substitution control enables more easily mix dynamic content in a cached
page. The Substitution control gives an island of dynamic content in an
cached page.You can find more details in
below URL:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/CachingNT2.asp
Regards,
Mitesh Mehta
Thursday, July 08, 2004
allowOverride Attribute
allowOverride Attribute If you have a common server where you are going to host your website and you do not want anyone to override your configuration settings after the site is deployed then within your web.config file, use < location > tag and set allowOverride attribute to false.... Mitesh Mehta If You Think YOU CAN... You Can... |
Controls
Controls
Web Server Control: provide a programming model that is more conducive to visual design environments similar to VBI think you should read this article:
http://www.msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/01/09/asp/toc.aspUsage
wise i have seen people prefer HTML controls to hande client site
events (javascript) and ServerControls to hande server side events. you
can add runat server attribute to htmlcontrols and handle server side
events also<asp:textbox>
vs the <input runat=server> tags , when to use one and the other,
it's up to what you're doing. In general, I would go with the
webcontrols.Regards,Jignesh Desai.
Installer for Globalization
Installer for Globalization
If you have different versions of your web application built for different
languages and you have separate resource files for each language when you
need to deploy your application according to the language settings of the
server then in that case make an Installer that has Custom Action to install
only location-specific files...
Vishal Joshi
Microsoft MVP .Net
If You Think YOU CAN... You Can...
Wednesday, July 07, 2004
Mixing Forms and Windows Security in ASP.NET
ASP.NET
developers have been asking for a way to combine Forms and Windows security. Paul Wilson provides a solution that does just that; it captures the Windows username, if possible, and otherwise redirects users to a logon screen. Check it our here |
Article: ASP.NET Grid View
This article discusses:
Very interesting and informative.. Rgds, Mitesh Mehta |
MVC Architecture in ASP.Net
MVC Architecture in ASP.Net
to understand the concept better
there are few articles:
This is very good site of OOPS
also.. |
Wednesday, June 30, 2004
Article:Creating your own web.config section handler
|
About Column Types in Data Grids
Column Types in Data Grids
A DataGrid control is formed by data bound columns. The control has
the ability to automatically generate columns that are based on the
structure of the data source. Auto-generation is the default behavior,
but you can manipulate that behavior by using a Boolean property named
AutoGenerateColumns. Set the property to false when you want the
control to display only the columns you explicitly add to the Columns
collection. Set it to true (the default) when you want the control to
add as many columns as is required by the data source. The default
algorithm for column generation creates simple data bound columns that
use literal controls to display the contents of the corresponding data
source fields. The DataGrid control supports additional column types
that can render the column data so that it performs an action when
clicked.
BoundColumn
Displays a column that is bound to a field in a data source. It displays each item in the field as plain text.
ButtonColumn
Displays a command button for each item in the column. The text of
the button can be data bound. The command name of the button must be
common to all items in the column. When the value for the command name
is Select, clicking the column button automatically selects the row.EditCommandColumn
Displays a button column that is automatically associated with the
Edit command. This class receives special support from the DataGrid
control, which is manifested as a redrawing of the clicked row using a
template.HyperLinkColumn
Displays the contents of each item in the column as a link. The link
text can be bound to a field in the data source, or it can be static
text. Also, the target URL can be data bound. Clicking a link column
causes the browser to jump to the specified URL. This column class
supports target frames.TemplateColumn
Displays each item in the column according to a specified template, allowing you to provide custom controls in the column.
RegardsMitesh
Monday, June 28, 2004
OT - Eclipsing .NET
You've heard the hype about .NET. You've read a couple of vague articles
about dynamic discovery and invocation, service-oriented architecture, and how
SOAP and a handful of other XML standards are forever changing the software
industry. These ideas have intrigued you and you're interested in learning more
- or at the very least, you recognize the importance of being able to add these
acronyms to your resumé. In either case, you want to explore the world of .NET,
but are unable or unwilling to fork over a thousand bucks for Microsoft's
Visual Studio .NET product. This article is for you. <o:p></o:p>
<o:p> </o:p>
http://www.sys-con.com/webservices/article.cfm?id=360<o:p></o:p>
HttpMoudles and HttpHandlers uses and explanation
HttpMoudles and HttpHandlers uses and explanation
HiBipin has a good article explaining the same.Regards,Jignesh Desai
Thursday, June 17, 2004
Smart Navigation
Smart Navigation
"SmartNavigation" is a Boolean property which can be set in the page's code behind or in the @page directive... This property is really helpful in case you want to enhance user experience... Set this property to true and you will get following advantages in navigation if your browser is IE 5.5 and above...
1.) Maintaining the scroll bar position (useful in long length pages) 2.) Set focus to the same control on which it was before navigation (useful in pages with lots of controls) 3.) saving last page state in the browser history (useful when a page does not changes considerably across frequent postbacks... e.g. changing control values on change of dates in calendar control) 4.) The flash effect caused during navigation (useful when your page is pretty heavy to load) |