tag:blogger.com,1999:blog-88782363593744013202024-02-07T00:06:18.344-08:00ASP.NET TutorialsUnknownnoreply@blogger.comBlogger21125tag:blogger.com,1999:blog-8878236359374401320.post-7625089690828248802012-07-09T22:47:00.001-07:002012-07-11T20:52:55.553-07:00FileUpload<div dir="ltr" style="text-align: left;" trbidi="on">FileUpload control is used to send a file to server from a client computer.<br />
<br />
<b>Some Commonly Used Properties of File Upload</b><br />
<span style="color: blue;">FileBytes Property:</span><br />
This property used to gets the array of bytes inwhich contents of the specified file is saved.<br />
<span style="color: blue;">FileContent Property:</span><br />
This is used to gets the stream object that points to a specified file uploaded by a fileupload control.<br />
<span style="color: blue;">FileName Property:</span><br />
This is used to gets the name of the file that is uploaded by the fileupload control.<br />
<span style="color: blue;">HasFile Property:</span><br />
This is used to check whether the fileupload control has a file or not.<br />
<br />
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-75154586748084334532012-07-09T22:03:00.000-07:002012-07-09T22:03:11.573-07:00Literal<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Asp.net Literal control is used to display a static text on web page without adding any HTML element.You can display text programmatically with server side code.You can display your text static but literal control is used only when you need to you the contents in server side otherwise you can use simple html tags.Literal control is similar to Label control but the difference is that you cannot apply any style on literal control.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghbDRsWO-aR9E8UgGKyFVQduPOGSkR-pMsGLRtJQc3Tm33oISAxx1vv5PYxTmuJ5wvAkVVEfEuEG1ZaU2Vp4JHgAYEuahlo0YhqWFA54nuzpmpsoBNugCT7wJBm5ULv49ajz-zc4aNZDp3/s1600/ap.net-literal.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghbDRsWO-aR9E8UgGKyFVQduPOGSkR-pMsGLRtJQc3Tm33oISAxx1vv5PYxTmuJ5wvAkVVEfEuEG1ZaU2Vp4JHgAYEuahlo0YhqWFA54nuzpmpsoBNugCT7wJBm5ULv49ajz-zc4aNZDp3/s320/ap.net-literal.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br />
</div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-10890630198637855242012-07-08T21:11:00.001-07:002012-07-10T02:46:12.852-07:00Panel<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">The asp.net panel control provides a container on small area within the web page inwhich we can use other controls.By adding controls into the panel we can handel them as a single unit for example hidding or showing them within web page.Simply asp.net panel control is used to create a distinct appearence for a group of controls within the panel control.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjiiMVLCLHwf5_M-ccXlOqppoGIF1DKomyMlNY7zyweT0FyR0SLgivTevED2NoEkq04jVRk_8rYEhP1EHk-GgZtruI-2k6gbRjSvb8hV7pXKWucs9IkqAYaQ1ntlcilOMtCZQ_wsmh6b6J/s1600/asp.net-panel.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjiiMVLCLHwf5_M-ccXlOqppoGIF1DKomyMlNY7zyweT0FyR0SLgivTevED2NoEkq04jVRk_8rYEhP1EHk-GgZtruI-2k6gbRjSvb8hV7pXKWucs9IkqAYaQ1ntlcilOMtCZQ_wsmh6b6J/s1600/asp.net-panel.png" /></a></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/CFRRHtsaZ4c?feature=player_embedded' frameborder='0'></iframe></div><span style="font-family: Arial, Helvetica, sans-serif;">
</span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-20137497108832725622012-07-08T03:06:00.000-07:002012-07-08T03:06:02.257-07:00ImageButton<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Image button is used to display a clickable image.We can set image on imagebutton by specifying the image path to ImageUrl property.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtJQfPJy15XN-Kgdg2RvtWC-5RXQzGNSDjtMxeOfxWqlizBXPyuaN8u8eAnBsLqcmbxJIKmfct9JdfuUbQbLX_R9gN7k5En8kYOdxdfJLGUwpVumfy5qHgYqq98BGiAA72JQgUtlq8_QbE/s1600/imagebutton-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtJQfPJy15XN-Kgdg2RvtWC-5RXQzGNSDjtMxeOfxWqlizBXPyuaN8u8eAnBsLqcmbxJIKmfct9JdfuUbQbLX_R9gN7k5En8kYOdxdfJLGUwpVumfy5qHgYqq98BGiAA72JQgUtlq8_QbE/s320/imagebutton-1.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><b><span style="font-family: Arial, Helvetica, sans-serif;">Some Commonly Used Properties For ImageButton</span></b></div><div class="separator" style="clear: both; text-align: left;"><b><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></b></div><div class="separator" style="clear: both; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">ImageUrl Property:</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">Gets the url of the image that is to be displayed on imagebutton.</span></div><div class="separator" style="clear: both; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">AlternateText Property:</span></div><span style="font-family: Arial, Helvetica, sans-serif;">Gets or stes the alternate text that will be displayed when image cannot be shown or found.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">ImageAlign Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">ImageAlign property is to set the alignment of the image.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">DescriptionUrl Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This property defines the url that contains the more detailed description of the image.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">OnClientClick Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This property defines the client side script that will be executed on client side onclick.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">Click Event:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the image is clicked.</span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-36807691043106420922012-07-07T20:12:00.001-07:002012-07-07T21:22:01.275-07:00BulletedList<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">ASP.NET BulletedList control is used to create a list of items with bulleted format.You can set bulleted format as circle or rectangle and you can add items in bulleted list by using <asp:ListItem>.You can specify your bullet style by using BulleteStyle property.You can display your list of items in an organized or unorganized form.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxqMEm740MJSNEopfKmet3tIOkSL7J3J8bZvz9VGUkc1FF9pnQbXW4PmTpDl4SLq1T0Zo0cSvcuaDkCaswMZuOIQtGFNdh4VfWb9Et6ZIHRwyTGaW7WFyEqg2Br6feK3vdgAQTC9NRCnle/s1600/bulletedList-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxqMEm740MJSNEopfKmet3tIOkSL7J3J8bZvz9VGUkc1FF9pnQbXW4PmTpDl4SLq1T0Zo0cSvcuaDkCaswMZuOIQtGFNdh4VfWb9Et6ZIHRwyTGaW7WFyEqg2Br6feK3vdgAQTC9NRCnle/s1600/bulletedList-1.png" /></a></div><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to Add Items Manually in BulletedLIst?</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To add items manually in bulleted list, first double click on bulletedList control in toolbox.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">After bulletedList is added into web page then click on the small tag on bulleted lis.then select <b>Edit Items </b>a new List Item Collection Editor box will appear.Now enter your item text that will appear in page and item's value.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmEfI3nhkCIUj6T8vA7qJyckh9_ouSywv4Qp7U-b_6JAZnh_SBH7XbGQ7vZF3glc1ghryGAYKXY3PyLnRYsGRkP0NLxShvHpep057mne7uAdAOgyS24e9nGtCDkwmY5KUci-LLTsum8Cyz/s1600/bulletedList-manually.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmEfI3nhkCIUj6T8vA7qJyckh9_ouSywv4Qp7U-b_6JAZnh_SBH7XbGQ7vZF3glc1ghryGAYKXY3PyLnRYsGRkP0NLxShvHpep057mne7uAdAOgyS24e9nGtCDkwmY5KUci-LLTsum8Cyz/s320/bulletedList-manually.png" width="320" /></a></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b>How to Add Listitems programmatically?</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can add items programmatically by specifying the following at the server side.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b>At Client SIde:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <asp:BulletedList ID="BulletedList1" runat="server"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Pakistan</asp:ListItem></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>UK</asp:ListItem></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>USA</asp:ListItem></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>France</asp:ListItem></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </asp:BulletedList></span><br />
<div style="font-weight: bold;"><span style="font-family: Arial, Helvetica, sans-serif;">At Server Side:</span></div><div><div><span style="font-family: Arial, Helvetica, sans-serif;"> protected void Page_Load(object sender, EventArgs e)</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> BulletedList1.Items.Add(new ListItem("Canada","Canada"));</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> BulletedList1.Items.Add(new ListItem("Australia", "Australia"));</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> BulletedList1.Items.Add(new ListItem("Russia", "Russian"));</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> BulletedList1.Items.Add(new ListItem("Itly", "Itly"));</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div><div style="font-weight: bold;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to display items from database?</b></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">To display list items from database simply provide the data source to the bulletedList control.To specify the data source to bulleted list first add you bulletedlist control into the web form and select it, a small tag will appear click on the small tag and select Choose Data Source option.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">A new Data Source configuration wizard box.With the help of this box you can simply provide your data source.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSVbyofHYJRkSnyJ2gKlsqYv9aonzAq9QxaZo7KSlzFuIOhyphenhyphenF9inj2Ps2rFzv-_Aj0pBTU7SK6ALAqpIn3XUIFEiem_KvJiulzgpl0QwcPtLVl5f5y_XKRwBoao6OIlqyI5DCTkneu8Oa0/s1600/bulletedList-datasource.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSVbyofHYJRkSnyJ2gKlsqYv9aonzAq9QxaZo7KSlzFuIOhyphenhyphenF9inj2Ps2rFzv-_Aj0pBTU7SK6ALAqpIn3XUIFEiem_KvJiulzgpl0QwcPtLVl5f5y_XKRwBoao6OIlqyI5DCTkneu8Oa0/s320/bulletedList-datasource.png" width="320" /></a></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to specify bullets as Custom Image in BulletedList control?</b></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">You can specify the bullets as custom image in bulletedList by using the BulletIamageUrl property.</span></div><div><div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:BulletedList ID="BulletedList1" runat="server" </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> BulletImageUrl="~/bullet.png" BulletStyle="CustomImage" Width="71px"></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Pakistan</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>UK</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>USA</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>France</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> </asp:BulletedList></span></div></div></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to display hyperlinks in BulledtedList control?</b></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">To display hyperlinks in bulleted list simply set DisplayMode is Hyperlink.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:BulletedList ID="BulletedList1" runat="server" </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> Width="71px" DisplayMode="LinkButton"></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">Pakistan</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">UK</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">USA</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">France</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> </asp:BulletedList></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9USH4HlzS9TYuxyG0a4GdyFynuDfSRBMT3UzJO2GtZ7KUlJfPvEE2msMiQkgLD5lqcqCQBE9FJ7wLRrKEHs5_ygtHYnRImuKLBfmh9dy0RYEKRe2ycFs0dOv1P4pXdYeK0bOIY15HLH9O/s1600/bulletlist-hyperlink.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9USH4HlzS9TYuxyG0a4GdyFynuDfSRBMT3UzJO2GtZ7KUlJfPvEE2msMiQkgLD5lqcqCQBE9FJ7wLRrKEHs5_ygtHYnRImuKLBfmh9dy0RYEKRe2ycFs0dOv1P4pXdYeK0bOIY15HLH9O/s1600/bulletlist-hyperlink.png" /></a></span></div><div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to display LinkButton in BulledtedList control?</b></span></div><span style="font-family: Arial, Helvetica, sans-serif;">To display linkbutton in bullet list simpply set the Display property is linkButton.</span></div><div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:BulletedList ID="BulletedList1" runat="server" </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> Width="71px" DisplayMode="LinkButton"></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Pakistan</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>UK</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>USA</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>France</asp:ListItem></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> </asp:BulletedList></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXDQlFw2xk0b7TWSjQDhzKOPZvFeaeMuFyqNx5gi367AiuBoy7Np5MKpLWrqvPbQi_i8oNDsHMmdZqSFTVqoqbfhOilLgBjLt0r25rqQxCcEb77AgOrYUjE9ASuDt3ZdM1VQ_Jx8HD3z01/s1600/bullet-linkbutton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXDQlFw2xk0b7TWSjQDhzKOPZvFeaeMuFyqNx5gi367AiuBoy7Np5MKpLWrqvPbQi_i8oNDsHMmdZqSFTVqoqbfhOilLgBjLt0r25rqQxCcEb77AgOrYUjE9ASuDt3ZdM1VQ_Jx8HD3z01/s1600/bullet-linkbutton.png" /></a></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"> </span></div></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-91167830692825929112012-07-01T19:39:00.000-07:002012-07-01T19:39:29.803-07:00ASP.NET Hidden Field<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Hidden Field is used to keep information on a web page that is not to displayed on the client side user.Hidden field is normally used to keep state information of web page just like view state,session state and cookies are used to maintain state information but there are some places where these controls are not available then there we use a hidden field control.Note that we can access the value of hidden field control at client side that way we does not keep ant sensitive information in the hidden field.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><asp:HiddenField ID="HiddenField1" runat="server" /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Some Commonly Used Properties For Hidden Field</b></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">Value Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can get or set value to hidden field.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">ValueChanged Event:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the value of the control changed.</span></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-57840275332675967572012-07-01T05:42:00.001-07:002012-07-01T05:45:26.580-07:00ASP.NET Calender<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Calendar control in asp.net is used to take a date as a input e.g. dob,hire date,birthday etc.</span><br />
<div><span style="font-family: Arial, Helvetica, sans-serif;">This control displays a full month at a time and you can select a single day or date from it.Similarly you can get single day,month,year,minutes,seconds and milliseconds etc.</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOufV7YbfsPPtOfP1M9IuSNQV7cE51sGOZ3WaK9mpDtISLuki2sMxoPFD8OhTUTui4ZFpslPRDTy9xdhWGb9BBcz_bzXz8jEPKMah-xw_eGg9Y_PzzM5o5lDsIpPJzwZ-m1BfNxyMii2YA/s1600/asp.net+calendar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOufV7YbfsPPtOfP1M9IuSNQV7cE51sGOZ3WaK9mpDtISLuki2sMxoPFD8OhTUTui4ZFpslPRDTy9xdhWGb9BBcz_bzXz8jEPKMah-xw_eGg9Y_PzzM5o5lDsIpPJzwZ-m1BfNxyMii2YA/s320/asp.net+calendar.png" width="320" /></a></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>Some Commonly Used Properties of Calendar</b></span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">Caption Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property set gets or sets the caption of the calendar control.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">CaptionAlign Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property gets or sets the alignment for caption of the calendar.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">DaHeaderStyle Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets the style properties for portion on the calendar that displays the day of the week.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">DayNameFormat Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the format of the day of the week.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">DayStyle Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets the style properties for the in displayed month.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">FirstDayOfWeek Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property define which day of week will be displayed in the first column of the calendar.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">NextMonthText Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the text of the next month navigation control.Usually it is >>.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">NextPrevFormat Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the format of the next ans previous month of the navigation control.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">PrevMonthText Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gats or sets the text of the previous month navigation control.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedDate Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the selected date of the calendar.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedDates Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the list of selected dates.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedDayStyle Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the selected style properties of the date.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">TodaysDate Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This is used to gets or sets the value for the today's date.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><b>Some Commonly Used Event For Calendar Control</b></span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectionChanged Event:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This event is raised when a single day,week or month is selected.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">DayRender Event:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This event is raised when a single cell of the calendar is rendered.</span></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-53427980566911232922012-06-23T01:07:00.003-07:002012-06-23T03:23:33.385-07:00ListBox<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">List box is used to display a list of one or more item so that user can choose one or more items from it.List box displays list of item sequentially and vertically in a scrollable window.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUF-DEVj4Hv7rGyEFm9LZ5bajn8-dP-DDDlYG0EeYRb5sNdOS-Kg3XVvx471NtR3BkG0GXioQS_iBuSttu5l93UMBTSjnQfLqjUPps9ZMbYHItrrNFYTAyHPLduidQNLQRN-Yb7rqFp2ma/s1600/Listbox1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUF-DEVj4Hv7rGyEFm9LZ5bajn8-dP-DDDlYG0EeYRb5sNdOS-Kg3XVvx471NtR3BkG0GXioQS_iBuSttu5l93UMBTSjnQfLqjUPps9ZMbYHItrrNFYTAyHPLduidQNLQRN-Yb7rqFp2ma/s1600/Listbox1.png" /></a></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">You can add values in Listbox manually or programmatically.To add values manually firstly add your listbox control into webpage and select it a small tag will appear on right side of listbox click on it and select Edit Items.</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmaJtrAcuPhF7N29iRMqIJMnAQFPZgSGmTfrI5mDcJrBIerSxEx0kAt0oq8-q8TWpxcBYOgNXZDjL7X5P0pTHzOAlOikxNVRmc47Dd-86YWY2eo592Sz8PHpMh_6l-bpYAdgNCVTS6wVZ4/s1600/Listbox-AddItem-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmaJtrAcuPhF7N29iRMqIJMnAQFPZgSGmTfrI5mDcJrBIerSxEx0kAt0oq8-q8TWpxcBYOgNXZDjL7X5P0pTHzOAlOikxNVRmc47Dd-86YWY2eo592Sz8PHpMh_6l-bpYAdgNCVTS6wVZ4/s1600/Listbox-AddItem-1.png" /></a></div><div><span style="font-family: Arial, Helvetica, sans-serif;">After click on Edit Items a ListItems Collection Editor box will appear .Click on Add button and enter your item's text in Text field and item's value in Value field.Your item will successfully added into listbox.Similarly you can add more values into listbox.At last click on OK button.</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTXUBDH1E-2L06Mwf3tMTwX2ja-dFTm9OnP9btG_PPxcl3LoOG5EVlFW6ntY8p-FuHGgoi3iZ4SaRY3cScnKuMx9UHwJX03RE2d3N6kn5l1xx6S2stEbVwKzSw3EztTj181lHLP3MdgMp5/s1600/Listbox-AddItem-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTXUBDH1E-2L06Mwf3tMTwX2ja-dFTm9OnP9btG_PPxcl3LoOG5EVlFW6ntY8p-FuHGgoi3iZ4SaRY3cScnKuMx9UHwJX03RE2d3N6kn5l1xx6S2stEbVwKzSw3EztTj181lHLP3MdgMp5/s320/Listbox-AddItem-2.png" width="320" /></a></div><div><span style="font-family: Arial, Helvetica, sans-serif;">Similarly you can add values into listbox from database.To add values from database click on small tag of listbox and select Choose Data Source.A new Data Source Configuration Wizard dialog box will appear.Now create a new data source or select a already created data source.</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicweLG8mPpIdA4PJQJKF46V304cZ4pIspJRfPJOy8sdBKiphwfWI-F1HmmXREcLU1fAjaoAGqc2nAdYVd7PJkeHh7zIxKmVoZ9M08dfxRsZjhtjIu0fzcaUe_8xusS1faEBRhy5tWVMu6-/s1600/Listbox-AddItem-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicweLG8mPpIdA4PJQJKF46V304cZ4pIspJRfPJOy8sdBKiphwfWI-F1HmmXREcLU1fAjaoAGqc2nAdYVd7PJkeHh7zIxKmVoZ9M08dfxRsZjhtjIu0fzcaUe_8xusS1faEBRhy5tWVMu6-/s320/Listbox-AddItem-3.png" width="320" /></a></div><div><span style="font-family: Arial, Helvetica, sans-serif;">After selection of Data Source click on OK button.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">To add values in listbox programmatically use the following code in PageLoad event. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> protected void Page_Load(object sender, EventArgs e)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> if(!IsPostBack)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> ListBox1.Items.Add(new ListItem("Pkistan", "Pkistan"));</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> ListBox1.Items.Add(new ListItem("Canada", "Canada"));</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> ListBox1.Items.Add(new ListItem("Paris", "Paris"));</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> ListBox1.Items.Add(new ListItem("UK", "UK"));</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> ListBox1.Items.Add(new ListItem("Itly", "Itly"));</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This code add the values in the listbox at run time.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Some Commonly Used Properties of ListBox</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedIndex Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the lowest index of the selected item in the listbox.This property will return the index as an integer.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedItem Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the selected item with the lowest index in the listbox control.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectedValue Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets the value of the selected item in the listbox control.This property will return the value as a string.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">SelectionMode Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Sets the selection mode of the listbox control.By using this property you can select one or more values from the listbox.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-51320606466883725462012-06-22T23:21:00.000-07:002012-06-22T23:21:32.418-07:00How To Add Class File in ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">To add a class file into asp.net follow these steps:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">step 1:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Open your asp.net project and goto solution explorer and right click on it and choose Add New Item->Class OR Add->Class</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Step 2:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Enter your class name and click on Add button.Your class.cs file will be added successfully.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/zUve3ydYP4w?feature=player_embedded' frameborder='0'></iframe></div><span style="font-family: Arial, Helvetica, sans-serif;"> </span></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-56942399759530606772012-06-22T22:43:00.000-07:002012-06-22T22:43:04.494-07:00How To Add a New WebForm in ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">In this tutorial we are going to discuss how to add a new webform in asp.net.We perform this task step by step.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Step 1:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Firstly open your asp.net project and goto solution explorer and right click on asp.net project file Add->New Item OR simply you can use New Item short cut.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Step 2:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> A New Item dialog box will appear choose first item which is WebForm.aspx.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Step 3:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Enter your web form name and click on Add button.Your new webForm will be successfully added into your asp.net project.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/UQ7XuMurIbY?feature=player_embedded' frameborder='0'></iframe></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-49769240710410595552012-06-19T04:00:00.000-07:002012-06-19T04:00:20.984-07:00Hyperlink<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Hyperlink control is used to navigate to the target URL when user clicks on the link.Hyperlink control and LinkButton control looks similar but there is some difference between Hyperlink and LinkButton control in ASP.NET.</span><span style="font-family: Arial, Helvetica, sans-serif;">When user clicks on a Hyperlink control the hyperlink control does not PostBack the page to the server.It will simply post the request to the server for the URL set in NavigateURL property.While LinkButton works like a simple button but it looks like a Hyperlink so LinkButton will PostBack the page to server.One other difference is that Hyperlink control does not have a OnClick event just like in LinkButton control.</span><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">Some Commonly Used Properties of Hyperlink Control</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">ImageURL Property:</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property is used to gets or sets the path to an image to display for the Hyperlink Control.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">IsTrackingViewState Property:</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property is used to gets a value that indicates whether the server control is saving changes to its view state.It will return a simple boolean value which represents true or false.If returned value is true that mean the control is set to save view state while in case of false the control will not save the view state.</span></div><div><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">NavigateURL Property:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">This property is used to gets or sets the URL to the link to when hyperlink control is clicked.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;">To see more properties click on link given below:</span></div><div><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlink_properties.aspx">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlink_properties.aspx</a> </div></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-79126886359121794232012-06-14T20:07:00.000-07:002012-06-14T20:07:39.394-07:00LinkButton<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">LinkButton is used to create a hyperlink in a website.This control looks like hyperlink but it has a same functionality of hyperlink control ans a button control.You can use the LinkButton control by specifying Text to display in linkbutton control by either the Text property or specifying the text between the opening tag and closing tag.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_DIFsgpwPXdOefjBVUnw-oaU83LpfEbvAihf7ZMor-MSidQSRFWtCwJDy7y_KRDpu4KFTPj0A-RL2PvUHLQsXZ3q-hkSA1HmZiCAn4strUZ5FRu6jI8mnV3An-6xLzf8WH6YOdV55T7TT/s1600/LinkButton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_DIFsgpwPXdOefjBVUnw-oaU83LpfEbvAihf7ZMor-MSidQSRFWtCwJDy7y_KRDpu4KFTPj0A-RL2PvUHLQsXZ3q-hkSA1HmZiCAn4strUZ5FRu6jI8mnV3An-6xLzf8WH6YOdV55T7TT/s1600/LinkButton.png" /></a></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">When you click on a linkbutton control then linkbutton take you to desired webpage by using PostBackUrl property e,g, PostBackUrl="~/how-to-use-textbox.aspx".</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>Some Commomly Used Properties</b></span></div><div class="separator" style="clear: both; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">Access Key Property:</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">Access Key is used to get or set the access key so that you can easily navigate to web sever controls.In other words we can say that access key is use to create a short cut key </span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">to web server controls.</span></div><div class="separator" style="clear: both; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">IsEnabled Proerty:</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">Gets a value that indicating whether the control is active or not.</span></div><div class="separator" style="clear: both; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">OnClickClient Property:</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the client side script that executes when a LinkButton's click event raised.</span></div><div class="separator" style="clear: both; text-align: left;"></div><pre style="font-family: Consolas, Courier, monospace; font-size: 13px; overflow: auto; padding: 5px; word-break: break-all; word-wrap: break-word;"><%@ page language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void LinkButton1_Click (object sender, EventArgs e)
{
Label1.Text = "LinkButton is clicked.";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
<title>LinkButton.OnClientClick Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>LinkButton.OnClientClick Example</h3>
<br />
<h4>Click to navigate to Microsoft.com:</h4>
<br />
<asp:linkbutton id="LinkButton1"
text="Open Web site"
onclientclick="Navigate()"
onclick="LinkButton1_Click"
runat="Server" />
<br /><br />
<asp:label id="Label1"
runat="Server">
</asp:label>
</form>
<script type="text/javascript">
function Navigate()
{
javascript:window.open("http://www.microsoft.com");
}
</script>
</body>
</html></pre><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">PostBackUrl Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13px;">The </span><span style="font-size: 13px;"><span class="selflink" style="font-weight: 700;">PostBackUrl</span></span><span style="font-size: 13px;"> property allows you to perform a cross-page post using the </span><span style="font-size: 13px;">LinkButton</span><span style="font-size: 13px;"> control. Set the </span><span style="font-size: 13px;"><span class="selflink" style="font-weight: 700;">PostBackUrl</span></span><span style="font-size: 13px;"> property to the URL of the Web page to post to when the </span><span style="font-size: 13px;">LinkButton</span><span style="font-size: 13px;"> control is clicked. For example, specifying Page2.aspx causes the page that contains the </span><span style="font-size: 13px;">LinkButton</span><span style="font-size: 13px;"> control to post to </span><span class="code" style="font-size: 14px;">Page2.aspx</span><span style="font-size: 13px;">. If you do not specify a value for the </span><span style="font-size: 13px;"><span class="selflink" style="font-weight: 700;">PostBackUrl</span></span><span style="font-size: 13px;"> property, the page posts back to itself.</span></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13px;"><br />
</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13px;">To see more properties of LinkButton control click following link:</span></span><br />
<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx"><span style="font-size: x-small;">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx</span></a></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8878236359374401320.post-51353622733667307712012-05-29T05:37:00.000-07:002012-05-29T05:37:33.527-07:00DropDownList<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span style="font-family: Arial, Helvetica, sans-serif;">DropDownList is used to create a drop-down list in which each item is defined by listitems.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">DropDownList is used when you want to bound the user such that he can select an option from a list of options.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1gNTTASHVnR8VnKyw2MSwwRimdiWw1ZE1zWCyZazUszxrdNq325JSRLxDKBVFw8VOBIZKtWGxTFVTykegyvnTWeyu8j2oZeJUhEXke6qaC72Q8NBfSaQbWTr8LOrKfiZwi55sqR6ljxMw/s1600/drop-down-list-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1gNTTASHVnR8VnKyw2MSwwRimdiWw1ZE1zWCyZazUszxrdNq325JSRLxDKBVFw8VOBIZKtWGxTFVTykegyvnTWeyu8j2oZeJUhEXke6qaC72Q8NBfSaQbWTr8LOrKfiZwi55sqR6ljxMw/s1600/drop-down-list-3.png" /></a></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;">Each item in drop-down list is defined by ListItem element.Inother words we can say that each item is created by ListItem control in asp.net.For example: </span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><asp:dropdownlist ID="Dropdownlist1" runat="server"></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>United States</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Germany</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Japan</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>China</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Russia</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Pakistan</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>India</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Australia</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>London</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"> <asp:ListItem>Canada</asp:ListItem></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"></asp:dropdownlist> </span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;">Here you can see DropDownList contains a ListItem control from which you can add your values.</span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to Add Values Manually in DropDownLIst?</b></span></div><div class="separator" style="clear: both;"></div><span style="font-family: Arial, Helvetica, sans-serif;">To manually add values in drop-down list you can use the previious code else follow this picture you can also add values graphically.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk4na7u1C_fwt_2HqtVE69z1d-SR7pAH-BQJWaDPgd_7HmewWfueaiuRDrjsAvJ6_NhQ7t2N5IO64FFPz3y3cjCIclxOHOEuIyd4coQw8enDvm2XbjceOXFmhlViiImO8wni8-s87Rwagr/s1600/drop-down-list-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk4na7u1C_fwt_2HqtVE69z1d-SR7pAH-BQJWaDPgd_7HmewWfueaiuRDrjsAvJ6_NhQ7t2N5IO64FFPz3y3cjCIclxOHOEuIyd4coQw8enDvm2XbjceOXFmhlViiImO8wni8-s87Rwagr/s320/drop-down-list-2.png" width="320" /></a></div><br />
<div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to Add Values Programmatically in DropDownLIst?</b></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;">If you want to set values to drop-down list at run time then you can use the following code at page load event or some other place wher you want.</span></span></div><div class="separator" style="clear: both;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><br />
</span></span></div><div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 13px; line-height: 15px;">protected void Page_Load(object sender, EventArgs e)</span></span></div><div style="background-color: white; font-size: 13px; line-height: 15px;"><span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div><span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 13px; line-height: 15px;"> RadioButtonList1.Items.Add(new ListItem("C#","C#"));</span><br style="background-color: white; font-size: 13px; line-height: 15px;" /><span style="background-color: white; font-size: 13px; line-height: 15px;"> RadioButtonList1.Items.Add(new ListItem("VB","VB"));</span><br style="background-color: white; font-size: 13px; line-height: 15px;" /><span style="background-color: white; font-size: 13px; line-height: 15px;"> RadioButtonList1.Items.Add(new ListItem("J#","J#"));</span><br style="background-color: white; font-size: 13px; line-height: 15px;" /><span style="background-color: white; font-size: 13px; line-height: 15px;"> RadioButtonList1.Items.Add(new ListItem("C++", "C++"));</span></span><div style="background-color: white; font-size: 13px; line-height: 15px;"><span style="font-family: Arial, Helvetica, sans-serif;"> }</span></div><br />
<br />
<br />
<div class="separator" style="clear: both;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>How to Add Values in DropDownLIst from Database?</b></span></div><span style="font-family: Arial, Helvetica, sans-serif;">if you want to get values from database and show them in drop-down list then use the following pocedure.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">First of all place your DropDownList control into web form.After placing the control a small tag will appear with the control click on it.Then two options will appear select or click Choose Data Source.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAtgMuTsPure_tGgZI06f3ggNb-2lvRJmXOtLet_WnGzMGHz7QnNpXAMpXq32VHqBja7EDuFFluTRF1Joxs_cXQCjn7zSfcxegLTsCWU_McoJwBA_GAR0gyV2NoRpYUkN4S98GRFleZ02-/s1600/drop-down-list-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="169" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAtgMuTsPure_tGgZI06f3ggNb-2lvRJmXOtLet_WnGzMGHz7QnNpXAMpXq32VHqBja7EDuFFluTRF1Joxs_cXQCjn7zSfcxegLTsCWU_McoJwBA_GAR0gyV2NoRpYUkN4S98GRFleZ02-/s320/drop-down-list-4.png" width="320" /></a></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">if your data source already exists then select it else create a new data source.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Some Commonly Used Properties of DropDownList</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Selected Value Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you to get a selected value from the drop-down list then you will you the SelectedValue property.This property returns the string value of the selected item in drop-down list.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Label1.Text = DropDownList.SelectedValue;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Selected Index Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">SelectedIndex property is used to Gets or Sets the index of the selected item.This property returns the index value as integer;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">int a = DropDownList.SelectedIndex;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Selected Item Property:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Selected Item property is used to gets the selected item with the lowest index in the list control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To see more properties use the following link:</span><br />
<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist_properties.aspx">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist_properties.aspx</a> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<br />
</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8878236359374401320.post-51703820162176061482012-05-25T23:44:00.004-07:002012-05-27T00:51:00.121-07:00RadioButtonList<div dir="ltr" style="text-align: left;" trbidi="on"><span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;">RadioButtonList is an ASP.NET control which is used to provide a list of radiobuttons for a input from the user.The user can check only a single option from a multiple options provides by the RadionButtonList.RadionButtonList is similar to RadioButton control but the difference is that you can add individual RadioButton controls to a page and work with them singly.In simple words you group two or many individual buttons together.On the otherhand RadioButtonList control a single control that treate as a parent control for a collection of radio button list items.RadioButtonlist control derived from a base ListControl Class and therefore it works like a ListBoxx,DropDownList and CheckBoxList controls.</span></span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><br />
</span></span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><b>How to Add RadioButton options Manully?</b> </span></span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;">To add an Radio Button options manully follow first </span></span><span style="color: #444444; font-family: Arial, Helvetica, sans-serif; line-height: 15px;">Add RadioButtonList control into your page.When you add a control into your page then a small tag will appear with the tag, click on it.</span><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkZ_VjCWRkcZyxm8amu_lqT9LzLY5UcpHueWZMaIYRFZBBy6vgcO-a0sDpp2UZdKhXDDMPkcBw8f9qHx_1bezJdbyK8TaAcl-wFTdhn9yFv4kmzfSlWLWmvmXi2X0kfbJLizkVeWlSzzkq/s1600/RadiobuttonList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkZ_VjCWRkcZyxm8amu_lqT9LzLY5UcpHueWZMaIYRFZBBy6vgcO-a0sDpp2UZdKhXDDMPkcBw8f9qHx_1bezJdbyK8TaAcl-wFTdhn9yFv4kmzfSlWLWmvmXi2X0kfbJLizkVeWlSzzkq/s320/RadiobuttonList.png" width="320" /></a> <br />
<br />
<div><span style="font-family: Arial, Helvetica, sans-serif;">After click following picture will appear then click on Edit Items then a List Collection Editor box will appear.By clicking on Add button you can add a new option by specifying by setting the Text and Value properties.</span><br />
<br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><b>How to Add Radio Button options Programmatically?</b></span></span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;">To add a ListItem into RadioButtonList, firstly you add a RadioButtonList control into your page then goto code behind file by pressing F7.At page_Load event write down the following code.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<div style="color: #444444;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><br />
</span></span></div><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><span style="color: #444444;"> </span><span style="color: blue;">protected</span><span style="color: #444444;"> </span><span style="color: blue;">void</span><span style="color: #444444;"> Page_Load(</span><span style="color: blue;">object</span><span style="color: #444444;"> sender, </span><span style="color: #6aa84f;">EventArgs</span><span style="color: #444444;"> e)</span></span></span><br />
<div style="color: #444444;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"> {</span></span></div><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><span style="color: #444444;"> RadioButtonList1.Items.Add(</span><span style="color: blue;">new</span><span style="color: #444444;"> </span><span style="color: #6aa84f;">ListItem</span><span style="color: #444444;">(</span><span style="color: red;">"C#"</span><span style="color: #444444;">,</span><span style="color: red;">"C#"</span><span style="color: #444444;">));</span></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><span style="color: #444444;"> RadioButtonList1.Items.Add(</span><span style="color: blue;">new</span><span style="color: #444444;"> </span><span style="color: #6aa84f;">ListItem</span><span style="color: #444444;">(</span><span style="color: red;">"VB"</span><span style="color: #444444;">,</span><span style="color: red;">"VB"</span><span style="color: #444444;">));</span></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><span style="color: #444444;"> RadioButtonList1.Items.Add(</span><span style="color: blue;">new</span><span style="color: #444444;"> </span><span style="color: #6aa84f;">ListItem</span><span style="color: #444444;">(</span><span style="color: red;">"J#"</span><span style="color: #444444;">,</span><span style="color: red;">"J#"</span><span style="color: #444444;">));</span></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"><span style="color: #444444;"> RadioButtonList1.Items.Add(</span><span style="color: blue;">new</span><span style="color: #444444;"> </span><span style="color: #6aa84f;">ListItem</span><span style="color: #444444;">(</span><span style="color: red;">"C++"</span><span style="color: #444444;">, </span><span style="color: red;">"C++"</span><span style="color: #444444;">));</span></span></span><br />
<div style="color: #444444;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 15px;"> }</span></span></div><div style="color: #444444; line-height: 15px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b>How To a Bind RadioButtonList control to Database?</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">We can bind a RadioButtonList control to a Database by providing sqlDataSource.</span></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-22635848468609938122012-05-19T20:50:00.002-07:002012-05-25T09:50:34.827-07:00CheckBoxList<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Checkboxlist is used to provide a list of checkboxes that can be created dynamically by binding it to the data source.Checkbox is used to select a single value while checkboxlist is used to get a group of information from the user.</span><br />
<b><span style="font-family: Arial, Helvetica, sans-serif;">How t Bind a Checkboxlist to Datasource:</span></b><br />
<br />
<div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: Arial, Helvetica, sans-serif;">To bind a checkboxlist to datasource first add the checkboxlist control into your page.When the checkboxlist control is added to your page then a smart tag appears which allows you to specify a datasource or add a items manually to the checkboxlist.Also click on <span style="color: #0b5394;">Edit Items </span>to open the ListItem collection editor and add items as shown infigure below:</span></div><div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNytigxnXKLchQaqPsvo3aUc8Ee9ZC2pJLRWpdd2fSzBCPyDs5Ln_x0PENh4xwOCMEsdZeX3a-PKP4X3a-xnzL7V_ZyzZ4bcg3jPVR9SHQL1HUWb1CBE6eGTIP4k7XefGo9Kz0paaJxV4L/s1600/checkboxlist-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="166" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNytigxnXKLchQaqPsvo3aUc8Ee9ZC2pJLRWpdd2fSzBCPyDs5Ln_x0PENh4xwOCMEsdZeX3a-PKP4X3a-xnzL7V_ZyzZ4bcg3jPVR9SHQL1HUWb1CBE6eGTIP4k7XefGo9Kz0paaJxV4L/s320/checkboxlist-1.jpg" width="320" /></a></div><div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 14px;"><b><br />
</b></span></span></div><br />
<b>How to Add items Programmatically in CheckBoxLIst: </b><br />
If you want to add items to checkboxlist programmatically, use the following code.<br />
<br />
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">protected</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">void</span><span style="font-family: 'Courier New'; font-size: 10pt;"> Page_Load(</span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">object</span><span style="font-family: 'Courier New'; font-size: 10pt;"> sender, </span><span style="color: #2b91af; font-family: 'Courier New'; font-size: 10pt;">EventArgs</span><span style="font-family: 'Courier New'; font-size: 10pt;"> e)</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">if</span><span style="font-family: 'Courier New'; font-size: 10pt;"> (!Page.IsPostBack)</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> cblMulti.Items.Add(</span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">new</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: 'Courier New'; font-size: 10pt;">ListItem</span><span style="font-family: 'Courier New'; font-size: 10pt;">(</span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 1"</span><span style="font-family: 'Courier New'; font-size: 10pt;">, </span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 1"</span><span style="font-family: 'Courier New'; font-size: 10pt;">));</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> cblMulti.Items.Add(</span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">new</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: 'Courier New'; font-size: 10pt;">ListItem</span><span style="font-family: 'Courier New'; font-size: 10pt;">(</span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 2"</span><span style="font-family: 'Courier New'; font-size: 10pt;">, </span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 2"</span><span style="font-family: 'Courier New'; font-size: 10pt;">));</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> cblMulti.Items.Add(</span><span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">new</span><span style="font-family: 'Courier New'; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: 'Courier New'; font-size: 10pt;">ListItem</span><span style="font-family: 'Courier New'; font-size: 10pt;">(</span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 3"</span><span style="font-family: 'Courier New'; font-size: 10pt;">, </span><span style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">"Items 3"</span><span style="font-family: 'Courier New'; font-size: 10pt;">));</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: Arial, Helvetica, sans-serif;">Here in the code cblmulti.Items.Add take the augument of New ListItem whereas ListItem takes two argument first is Text and Second is Value.</span></div><div class="MsoNormal" style="background: white; line-height: 15.0pt; text-align: justify;"><span style="font-family: 'Courier New';"><span style="font-size: 14px;"><br />
</span></span></div></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-52189856390061431272012-05-13T22:40:00.003-07:002012-05-14T03:38:19.630-07:00Button<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;">Asp.Net Button is used to submit information to the server.By default asp.net button is a Submit Button.When the user click on button then the button post back the web page to the server.To include as.net button in your project goto toolbox and double click on Button control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> <span style="color: blue;"><</span><span style="color: #990000;">asp:Button</span> <span style="color: red;">ID</span><span style="color: blue;">="Button1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">Text</span><span style="color: blue;">="Button"</span> <span style="color: blue;">/></span> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Properties of Asp.Net Button</b></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Access Key Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the access key that allows you to quickly navigate to web server control.The default value of access key is Empty which shows that this property is not set.AccessKey is used to specify the keyboard shortcut for the web server control.This allow you to access the control quickly and easily by pressing the ALT key and that key you specified on the keyboard.For example, setting the access key of a control to the string "B" shows that the user can navigate to the control by pressing ALT+B.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Remember that only a single character is allowed for the access key.If you set access key to the value that is neither null, Empty nor a single character then the exception will be thrown.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><asp:Button id="button1" accessKey="B" /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ClientID Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets the control ID for HTML markup that is generated by Asp.Net. When the web server control is rendered as an HTML element then id attribute of HTML element is set to the value of ClientID property then the clientID property is used accesscthe HTML element at client side scripting by using document.getElementById method.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue; font-size: large;"><b>ClientIDMode Property:</b></span> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the algorithm that is used to generate the value of ClientID property.Asp.Net provides several algorithms to define how to generate the value of clientID property.The possible values are <span style="color: #0b5394;">AutoID</span>,<span style="color: #0b5394;">Static</span>,<span style="color: #0b5394;">Predictable</span> and <span style="color: #0b5394;">Inherit</span>.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CommandName Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the Command name associated with Button control that is passed to the Command Event.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">When you have a many button controls on your web page then use the CommandName property to find out the command name associated with each button control.You can set the any string with CommandName property that identifies the command toperform then by programmatically you can get the command name of button control and perform action.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For example:</span><br />
<br />
<pre style="font-family: Consolas, Courier, monospace; font-size: 13px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="color: blue;">void</span> CommandBtn_Click(Object sender, CommandEventArgs e) </pre><pre style="font-family: Consolas, Courier, monospace; font-size: 13px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;">{</pre><br />
<br />
<pre style="font-family: Consolas, Courier, monospace; font-size: 13px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="color: blue;">switch</span>(e.CommandName)
{
<span style="color: blue;">case</span> <span style="color: #a31515;">"Asceding"</span>:
<span style="color: green;">// Call the method to sort the list in ascending order.</span>
Sort_List((String)e.CommandArgument);
<span style="color: blue;">break</span>;
<span style="color: blue;">case</span> <span style="color: #a31515;">"descending"</span>:</pre><pre style="font-family: Consolas, Courier, monospace; font-size: 13px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><pre style="font-family: Consolas, Courier, monospace; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="color: green;"> //Call the method to sort the list in descending order.</span></pre><pre style="font-family: Consolas, Courier, monospace; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="color: green;"> </span>Sort_List((String)e.CommandArgument);<span style="color: green;"> </span></pre><span style="color: blue;">break</span>;
<span style="color: blue;">default</span>:
<span style="color: green;">// The command name is not recognized. Display an error message.</span>
Message.Text = <span style="color: #a31515;">"Command name not recogized."</span>;
<span style="color: blue;">break</span>;
}</pre><br />
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Enabled Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the the value indicating whether the web server control is enabled.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ID Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Gets or Sets the identifier to the web server control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>OnClientClick Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;">Gets or sets the client-side script that executes when a </span><span style="background-color: white; line-height: 18px;"><span class="selflink" style="font-weight: 700;">Button</span></span><span style="background-color: white; line-height: 18px;"> control's click</span><span style="background-color: white; line-height: 18px;"> event is raised.</span></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b><br />
</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="color: blue;"><b>PostBackUrl</b></span><b> </b></span><b style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: x-large;">Property:</b><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;">Gets or sets the URL of the page to post to from the current page when the </span><span style="background-color: white; line-height: 18px;"><span class="selflink" style="font-weight: 700;">Button</span></span><span style="background-color: white; line-height: 18px;"> control is clicked.</span></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="background-color: white; line-height: 18px;"><b>TabIndex Property:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="background-color: white; line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;">Gets or Sets the tab index of the web server control.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="background-color: white; line-height: 18px;"><b>Text Property:</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Gets or Sets the text to be displayed on the button control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b>ToolTip Prpperty:</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Gets or Sets the text to be displayed when the mouse pointer hover over the web server control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="font-size: large;"><b>Some Useful Methods of Button</b></span></span><span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="font-size: large;"><b><br />
</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>DataBind() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Binds a data source to the invoked server control and all its child controls.</span><span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 18px;"> </span><br />
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b>Dispose() Method:</b></span></span><br />
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b><br />
</b></span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;">Enables a server control to perform final clean up before it is released from memory.</span></span> <br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue; font-size: large;"><b>GetPostBackOption() Methid:</b></span> </span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue; font-size: large;"><b><br />
</b></span></span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;">This method creates an object of <span style="color: #0b5394;">PostBackOptions </span>that shows the postback behaviour of button control.</span></span><span style="font-family: Arial, Helvetica, sans-serif;">The PostBackOptions object is then passed to the ClientScriptManager<span xmlns="">.</span>GetPostBackEventReference(PostBackOptions) method, which obtain a reference to a client-side script function that, when invoked, causes the server to post back to the page.</span><span style="font-family: 'Segoe UI', Verdana, Arial;">You can override the</span><span style="font-family: 'Segoe UI', Verdana, Arial;"> </span><span class="selflink" style="font-family: 'Segoe UI', Verdana, Arial; font-weight: 700;">GetPostBackOptions</span><span style="font-family: 'Segoe UI', Verdana, Arial;"> </span><span style="font-family: 'Segoe UI', Verdana, Arial;">method in your derived class to modify the postback options for the button control.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="background-color: white; line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="background-color: white; line-height: 18px;"><b><span style="color: blue;">OnClick() Method:</span> </b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Callls the Click event of button control.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OnCommand() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Calls the command event of button control.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OnDataBinding() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Calls the DataBinding event of button control.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OnInit() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Calls the Init event.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OnLOad() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Calls the Load event.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OnUnload() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Calls the unload event.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>OpenFile() Method:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Gets a stream as a argument to read a file.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>Some Useful Events of Button</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>Click Event:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;">Fires when button control is clicked.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="line-height: 18px;"><br />
</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b>Command Event:</b></span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 18px;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Fires when button control is clicked.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b>DataBinding Event:</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Fires when the server controls binds to a data source.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b>Init Event:</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;"><span style="color: blue; font-size: large;"><b><br />
</b></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Occurs when server control is initialized.</span></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8878236359374401320.post-35898889191070543782012-05-12T02:58:00.002-07:002012-05-12T03:10:19.293-07:00Radio Button<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Radio buttons</span><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> are used when there is a list of two or more item that are </span><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">mutually exclusive</span><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> and the user need to select exactly one item. By using radio buttons, clicking a non-selected radio button will deselect whatever other radio button was previously selected in the list of items</span></span><span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 20px; text-align: -webkit-auto;">.To add a radio button into your project goto toolbox and double click on RadioButtons.</span><br />
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 20px; text-align: -webkit-auto;">For example:</span><br />
<br />
<span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"><</span><span style="color: #cc0000;">asp:RadioButton</span> <span style="color: red;">ID</span><span style="color: blue;">="RadioButton1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server" </span><span style="color: red;">Text</span><span style="color: blue;">= "Radiobutton"</span> <span style="color: red;">Checked</span><span style="color: blue;">="true"/></span></span></span><br />
<span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"><br />
</span></span></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4UIVlMiUTchglJAfoT5st9l-BeLgKV_mCzJAGLj3gaXyEp-9YU8UEb493FQ16U2z9immbr4-lRZwOhziotJUrr6o5JzA7smANmBXKMgWYSJ-gTTYjX4CdqBZJ34LwaAXMFDCnlOEhUTmM/s1600/RadioButton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4UIVlMiUTchglJAfoT5st9l-BeLgKV_mCzJAGLj3gaXyEp-9YU8UEb493FQ16U2z9immbr4-lRZwOhziotJUrr6o5JzA7smANmBXKMgWYSJ-gTTYjX4CdqBZJ34LwaAXMFDCnlOEhUTmM/s1600/RadioButton.png" /></a></div><span style="font-family: Arial, Helvetica, sans-serif; font-size: large; line-height: 20px; text-align: -webkit-auto;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large; line-height: 20px; text-align: -webkit-auto;">Some Useful Properties of Radio Buttons</span><br />
<div style="text-align: -webkit-auto;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><span style="line-height: 20px;"><br />
</span></span></div><div style="text-align: -webkit-auto;"></div><div class="MsoNormal" style="text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ID Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton.ID property id used to set the ID of </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radio button</span> <span style="font-family: Arial, Helvetica, sans-serif;">control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> // Set a ID to a </span><span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.ID = "chkUserName";</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><b style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: x-large;">Text Property:</b><br />
<span style="font-family: Arial, Helvetica, sans-serif;">We can set a value to </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span> <span style="font-family: Arial, Helvetica, sans-serif;">by using </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;"><b>Radiobutton</b></span><b style="font-family: Arial, Helvetica, sans-serif;">.Text</b><span style="font-family: Arial, Helvetica, sans-serif;"> </span><b style="font-family: Arial, Helvetica, sans-serif;"> </b><span style="font-family: Arial, Helvetica, sans-serif;">property.For example</span></div><div class="MsoNormal" style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;">{<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> // set a text to </span><span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton1</span><span style="font-family: Arial, Helvetica, sans-serif;">.Text = "Male";</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Radiobutton2.Text = "Female";</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;">}</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Enabled Property:</span></b></div><div class="MsoNormal" style="margin-bottom: 7.5pt; text-align: left;"><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Enabled property enable the state of </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span> <span style="font-family: Arial, Helvetica, sans-serif;">control..Initially its value is true.</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Button1_Click(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Enabled = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Visible Property:</span></b></div></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Visible property is used to set the visiblity of a </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.If its value is true then </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span> <span style="font-family: Arial, Helvetica, sans-serif;">will be visible otherwise it will be hide for user.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">protected</span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">void</span><span style="font-family: Arial, Helvetica, sans-serif;"> Button1_Click(</span><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">object</span><span style="font-family: Arial, Helvetica, sans-serif;"> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Radiobutton1</span><span style="font-family: Arial, Helvetica, sans-serif;">.Visible = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Height & Width Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">You can use the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Height</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property along with the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Width</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property to size an object to specific dimensions.</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;">protected</span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">void</span><span style="font-family: Arial, Helvetica, sans-serif;"> Button1_Click(</span><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">object</span><span style="font-family: Arial, Helvetica, sans-serif;"> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Height = 100px;<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Width = 100px;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CssClass Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can use the <span class="selflink" style="font-weight: 700;">CssClass</span> property to specify the CSS(Cascadding Style Sheet) class to render on the client for the Web Server control. This property will render on browsers for all controls. In simple words you can add CssClass by using CssClass property by just giving a cssclass name.</span><br />
<pre style="overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">
</span></span></pre><pre style="overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"><</span><span style="color: #cc0000;">asp:RadioButton</span><span style="color: blue;"> </span><span style="color: red;">ID</span><span style="color: blue;">="checkbox1" </span><span style="color: red;">runat</span><span style="color: blue;">="server" </span><span style="color: red;">Text</span><span style="color: blue;">="Subjects" </span><span style="color: red;">CssClass</span><span style="color: blue;">="HomePage"></</span><span style="color: #cc0000;">asp:</span></span><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: #cc0000;">RadioButton</span></span><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">></span></pre></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="font-family: Arial, Helvetica, sans-serif; font-size: x-large;"><br />
</b><br />
<b style="font-family: Arial, Helvetica, sans-serif; font-size: x-large;">Some Useful Events of RadioButton</b></div></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></b><br />
<b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Init Event:</span></b></div><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the page has been initialized.During page initialization, controls on the page are accessible and each control's UniqueID property is set. A master page and themes are also applied to the page if required. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> </span> <span style="font-family: Arial, Helvetica, sans-serif;">RadioButton</span><span style="font-family: Arial, Helvetica, sans-serif;">_Init(<span style="color: blue;">object</span> sender, EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Here you can write your logic...<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal" style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><o:p></o:p></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;">Load Event:</span></h1><div style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the web page has been loaded.During load, the opposite happens to the Init Event, all the postback data has been set and all the controls are ready and can fire their different events. The top container, the content page loads first as it can change the master page and user controls, then the master page and in the end the leaf controls.</span></div><div style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div style="text-align: left;"><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> </span> <span style="font-family: Arial, Helvetica, sans-serif;">RadioButton</span> <span style="font-family: Arial, Helvetica, sans-serif;">_Load(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Here You can write your code.<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CheckedChanged Event:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This event occurs when the user changed the checked property of the control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Methods of </b></span><b style="font-family: Arial, Helvetica, sans-serif; font-size: x-large;">RadioButton</b></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b><br />
</b></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-align: left;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;">Focus Method:</span></h1><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;">How to Set Focus on Asp.Net ?</span><span style="color: #3f529c; font-size: 21pt;"><o:p></o:p></span></span></h1><div class="MsoNormal" style="text-align: left;"><span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Focus() method is use to set the control on a </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Focus method is helpful to reduce the use of mouse and user can easily get a control by using keyboard.</span><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></b><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;">AT Server Side : </span></b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; text-align: left; vertical-align: baseline;"><span style="color: #e66a38; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span> sender, EventArgs e)<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span> <span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Focus();<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br />
</span><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;">At Client Side:</span></b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; text-align: left; vertical-align: baseline;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"><%@ Page Language=</span><span style="color: #a31515; font-size: 10pt;">"C#"</span><span style="font-size: 10pt;"> %><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><html><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"><head runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;">><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <title>Test Page</title><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></head><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <form id=</span><span style="color: #a31515; font-size: 10pt;">"form1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;"> defaultfocus=</span><span style="color: #a31515; font-size: 10pt;">"TextBox1"</span><span style="font-size: 10pt;"> ><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <asp:</span></span> <span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: x-small;">Radiobutton</span></span> <span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> ID=</span><span style="color: #a31515; font-size: 10pt;">"Checkbox1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;">></asp:</span></span><span style="font-size: x-small;"><span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span></span><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;">><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <asp:Button ID=</span><span style="color: #a31515; font-size: 10pt;">"Button1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;"> Text=</span><span style="color: #a31515; font-size: 10pt;">"Button"</span><span style="font-size: 10pt;"> /><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> </div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> </form><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; text-align: left; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></html><o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Databind() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Radiobutton</span><span style="font-family: Arial, Helvetica, sans-serif;">.Databind() binds the datasource to the invoked server control and all its child controls.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Dispose() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 14px;">Checkbox</span><span style="font-family: Arial, Helvetica, sans-serif;">.Dispose() enables a server control to perform a final cleanup before it is released from memory.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To see more properties of Radiobutton click the link given below.</span></div><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.radiobutton_properties.aspx">http://msdn.microsoft.com/en-us/library/system.windows.forms.radiobutton_properties.aspx</a> </div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8878236359374401320.post-89282656431641541812012-05-11T03:41:00.005-07:002012-05-12T03:07:23.001-07:00Checkbox<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Arial, Helvetica, sans-serif; line-height: 115%;">Checkbox is used to select multiple items including zero, one or more at a same time .In other words we can say each checkbox is independent to other checkboxes so checking one checkbox does not matter the other unchecked boxes.</span><span style="font-family: Arial, Helvetica, sans-serif; line-height: 17px;">To add a checkbox in your project goto toolbox and double click on Checkbox control.</span><br />
<div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif; line-height: 115%;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"> <</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">CheckBox</span> <span style="color: red;">ID</span><span style="color: blue;">="CheckBox1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">Text</span><span style="color: blue;">="Checkbox"</span> <span style="color: red;">Checked</span><span style="color: blue;">="true"/><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family: Arial, Helvetica, sans-serif;">By using checked property is true you can make checkbox initially checked and by specifying false you can make checkbox initially unchecked.</span><span style="font-family: Arial, Helvetica, sans-serif;">By using text property you can display text with your checkbox as given below.</span><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlpUdvIdd5KRA9hu814vxw97V6BLImTQ66htbx-SPYwufQGT1kInl454LEodj6T-C0OMdH7h8_AoEj64OoRcSAd87IHglCLgHPam0st1JRsEsP_EiLmUo4DpSfswL-XCJPYEgH3ytLRjFF/s1600/checkbox.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlpUdvIdd5KRA9hu814vxw97V6BLImTQ66htbx-SPYwufQGT1kInl454LEodj6T-C0OMdH7h8_AoEj64OoRcSAd87IHglCLgHPam0st1JRsEsP_EiLmUo4DpSfswL-XCJPYEgH3ytLRjFF/s1600/checkbox.png" /></a><br />
<br />
<br />
<div class="MsoNormal" style="background-color: white; margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal" style="line-height: 18px; margin-bottom: 9pt; word-break: break-all;"><b style="background-color: transparent; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Some Useful Properties of Checkbox:</span></b></div></div><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ID Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Checkbox.ID property id used to set the ID of checkbox control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> // Set a ID to a Checkbox</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> checkbox.ID = "chkUserName";</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Text Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">We can set a value to checkbox by using </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><b style="font-family: Arial, Helvetica, sans-serif;">Checkbox1.Text</b><span style="font-family: Arial, Helvetica, sans-serif;"> </span><b style="font-family: Arial, Helvetica, sans-serif;"> </b><span style="font-family: Arial, Helvetica, sans-serif;">property.For example</span></div><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue; font-size: 10pt;">protected</span><span style="font-size: 10pt;"> </span><span style="color: blue; font-size: 10pt;">void</span><span style="font-size: x-small;"> Page_Load(</span><span style="color: blue; font-size: 10pt;">object</span><span style="font-size: 10pt;"> sender, System.EventArgs e)</span></span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;">{<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> // set a text to checkbox</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;"> Checkbox</span><span style="font-family: Arial, Helvetica, sans-serif;">1</span><span style="font-family: Arial, Helvetica, sans-serif;">.Text = "Remeber me";</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Enabled Property:</span></b></div><div class="MsoNormal" style="margin-bottom: 7.5pt;"><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">Checkbox.Enabled property enable the state of Checkbox control..Initially its value is true.</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Button1_Click(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> checkbox1.Enabled = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Visible Property:</span></b></div></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Checkbox.Visible property is used to set the visiblity of a checkbox.If its value is true then checkbox will be visible otherwise it will be hide for user.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Button1_Click(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> checkbox1.Visible = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Height & Width Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">You can use the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Height</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property along with the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Width</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property to size an object to specific dimensions.</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Button1_Click(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> chekbox1.Height = 100px;<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> chekbox1</span><span style="font-family: Arial, Helvetica, sans-serif;">.Width = 100px;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CssClass Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can use the <span class="selflink" style="font-weight: 700;">CssClass</span> property to specify the CSS(Cascadding Style Sheet) class to render on the client for the Web Server control. This property will render on browsers for all controls. In simple words you can add CssClass by using CssClass property by just giving a cssclass name.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 13px;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<pre style="overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"> <</span><span style="color: #660000;">asp:Label</span><span style="color: blue;"> </span><span style="color: red;">ID</span><span style="color: blue;">="checkbox1" </span><span style="color: red;">runat</span><span style="color: blue;">="server" </span><span style="color: red;">Text</span><span style="color: blue;">="Subjects" </span><span style="color: red;">CssClass</span><span style="color: blue;">="HomePage"></</span><span style="color: red;">asp:Label</span><span style="color: blue;">></span></span></pre></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span></div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Events of Checkbox</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></b><br />
<b style="color: blue; font-size: x-large;"><span style="font-family: Arial, Helvetica, sans-serif;">Init Event:</span></b></div><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the page has been initialized.During page initialization, controls on the page are accessible and each control's UniqueID property is set. A master page and themes are also applied to the page if required. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Checkbox1_Init(<span style="color: blue;">object</span> sender, EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Here you can write your logic...<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><o:p></o:p></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;">Load Event:</span></h1><div><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the web page has been loaded.During load, the opposite happens to the Init Event, all the postback data has been set and all the controls are ready and can fire their different events. The top container, the content page loads first as it can change the master page and user controls, then the master page and in the end the leaf controls.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Checkbox_Load(<span style="color: blue;">object</span> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Here You can write your code.<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Methods of Label</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b><br />
</b></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;">Focus Method:</span></h1><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;">How to Set Focus on Asp.Net ?</span><span style="color: #3f529c; font-size: 21pt;"><o:p></o:p></span></span></h1><div class="MsoNormal"><span style="font-family: Arial, Helvetica, sans-serif;">Checkbox1.Focus() method is use to set the control on a Checkbox.Focus method is helpful to reduce the use of mouse and user can easily get a control by using keyboard.</span><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></b><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;">AT Server Side : </span></b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="color: #e66a38; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;">protected</span> <span style="color: blue;">void</span> Checkbox_Load(<span style="color: blue;">object</span> sender, EventArgs e)<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"> Checkbox1.Focus();<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">}<o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br />
</span><br />
<b style="background-color: white; font-size: small;"><span style="font-family: Arial, Helvetica, sans-serif;">At Client Side:</span></b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"><%@ Page Language=</span><span style="color: #a31515; font-size: 10pt;">"C#"</span><span style="font-size: 10pt;"> %><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><html><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"><head runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;">><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <title>Test Page</title><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></head><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <form id=</span><span style="color: #a31515; font-size: 10pt;">"form1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;"> defaultfocus=</span><span style="color: #a31515; font-size: 10pt;">"TextBox1"</span><span style="font-size: 10pt;"> ><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <asp:Checkbox ID=</span><span style="color: #a31515; font-size: 10pt;">"Checkbox1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;">></asp:</span></span> <span style="font-family: Arial, Helvetica, sans-serif; font-size: 14px;">Checkbox</span> <span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;">><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 10pt;"> <asp:Button ID=</span><span style="color: #a31515; font-size: 10pt;">"Button1"</span><span style="font-size: 10pt;"> runat=</span><span style="color: #a31515; font-size: 10pt;">"server"</span><span style="font-size: 10pt;"> Text=</span><span style="color: #a31515; font-size: 10pt;">"Button"</span><span style="font-size: 10pt;"> /><o:p></o:p></span></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> </div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"> </form><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"></html><o:p></o:p></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Databind() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 14px;"><b>Checkbox</b></span><span style="font-family: Arial, Helvetica, sans-serif;">.Databind() binds the datasource to the invoked server control and all its child controls.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Dispose() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 14px;">Checkbox</span><span style="font-family: Arial, Helvetica, sans-serif;">.Dispose() enables a server control to perform a final cleanup before it is released from memory.</span></div><span style="font-family: Arial, Helvetica, sans-serif;"><br class="Apple-interchange-newline" /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To see more properties of checkbox click the link given below:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox_properties.aspx">http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox_properties.aspx</a> </div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-79986844253560010952012-05-07T23:51:00.008-07:002012-05-11T11:42:50.885-07:00Labels<div dir="ltr" style="text-align: left;" trbidi="on">In asp.net labels are used to display messages for a user to enter a correct input.To include a labels in your project goto toolbox and double click on <b>Labels.</b>Following text will be appeared.<br />
<br />
<div class="MsoNormal" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><br />
</span></div><div class="MsoNormal" style="background-color: white; margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><%@ Page Language=</span><span style="font-family: Consolas; font-size: 10pt;">"C#"</span><span style="font-family: Consolas; font-size: 10pt;"> %><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><html><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><head runat=</span><span style="font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;">><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <title>Test Page</title><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></head><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><body><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <form id=</span><span style="font-family: Consolas; font-size: 10pt;">"form1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;"> defaultfocus=</span><span style="font-family: Consolas; font-size: 10pt;">"TextBox1"</span><span style="font-family: Consolas; font-size: 10pt;"> ><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <div><o:p></o:p></span></div><div class="MsoNormal" style="font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><div style="font-size: medium; line-height: normal;"></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> <</span><span style="font-family: Consolas;">asp</span><span style="font-family: Consolas;">:</span><span style="font-family: Consolas;">Label</span><span style="font-family: Consolas;"> </span><span style="font-family: Consolas;">ID</span><span style="font-family: Consolas;">="Label1"</span><span style="font-family: Consolas;"> </span><span style="font-family: Consolas;">runat</span><span style="font-family: Consolas;">="server"></</span><span style="font-family: Consolas;">asp</span><span style="font-family: Consolas;">:</span><span style="font-family: Consolas;">Label</span><span style="font-family: Consolas;">></span></div></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </div></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </form><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></body><o:p></o:p></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></html></span></div><div class="MsoNormal" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px; margin-bottom: 9pt; word-break: break-all;"><b style="background-color: transparent; font-size: x-large;">Some Useful Properties of Label:</b></div></div><div class="MsoNormal"><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ID Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Label1.ID property id used to set the ID of label control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<br />
<span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Page_Load(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span><br />
<span style="font-family: Consolas;"> // Set a ID to a Label</span><br />
<span style="font-family: Consolas;"> Label1.ID = "lblUserName";</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><br />
<span style="color: blue; font-size: large;"><b>Text Property:</b></span><br />
We can get value from a label by using <b>Label1.Text</b> property and set a value to textbox by using <b>Label1.Text</b> <b> </b>property.For example</div><div class="MsoNormal"><br />
<span style="color: blue; font-family: Consolas; font-size: 10pt;">protected</span><span style="font-family: Consolas; font-size: 10pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10pt;">void</span><span style="font-family: Consolas;"><span style="font-size: x-small;"> Page_Load(</span></span><span style="color: blue; font-family: Consolas; font-size: 10pt;">object</span><span style="font-family: Consolas; font-size: 10pt;"> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas;"> // Get a value from Label</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> string userName = Label1.Text;<o:p></o:p></span><br />
<span style="font-family: Consolas;"> //Set a value to Label</span><br />
<span style="font-family: Consolas;"> </span> <span style="font-family: Consolas;">Label1</span><span style="font-family: Consolas;">.Text = userName;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> </span> <span style="font-family: Consolas;">Label1</span><span style="font-family: Consolas;">.Text = </span> <span style="font-family: Consolas;">Label2</span><span style="font-family: Consolas;">.Text;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"></div><div class="MsoNormal" style="margin-bottom: 7.5pt;"><b style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: x-large;">Enabled Property:</b><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">Label</span><span style="font-family: Arial, Helvetica, sans-serif;">.Enabled property anable the state of </span> <span style="font-family: Consolas;">Label</span><span style="font-family: Arial, Helvetica, sans-serif;"> control.It is similar to Readonly property but the difference is that you can copy the contents by Readonly property but with Enabled property you even can't copy the contents.Initially its value is true.</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> </span> <span style="font-family: Consolas;">Label1</span><span style="font-family: Consolas;">.Text = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: x-large;">Visible Property:</b></div></div><br />
<span style="font-family: 'Segoe UI', sans-serif;">Textbox.Visible property is used to set the visiblity of a textbox.If its value is true then textbox will be visible otherwise it will be hide for user.</span><br />
<span style="font-family: 'Segoe UI', sans-serif;"><br />
</span><br />
<br />
<div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox1.Text = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Height & Width Property:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">You can use the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Height</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property along with the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Width</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property to size an object to specific dimensions.</span></span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><br />
</span><br />
<br />
<div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Label1.Height = 100px;<o:p></o:p></span><br />
<span style="font-family: Consolas;"> Labael1.Width = 100px;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span><br />
<span style="font-family: Consolas;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>CssClass Property:</b></span><br />
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;">You can use the </span><span style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;"><span class="selflink" style="font-weight: 700;">CssClass</span></span><span style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;"> property to specify the CSS(Cascadding Style Sheet) class to render on the client for the Web Server control. This property will render on browsers for all controls. In simple words you can add CssClass by using CssClass property by just giving a cssclass name.</span><br />
<span style="font-family: 'Segoe UI', Verdana, Arial; font-size: 13px;"><br />
</span><br />
<br />
<pre style="overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; word-break: break-all; word-wrap: break-word;"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"> <</span><span style="color: #660000;">asp:Label</span><span style="color: blue;"> </span><span style="color: red;">ID</span><span style="color: blue;">="Label1" </span><span style="color: red;">runat</span><span style="color: blue;">="server" </span><span style="color: red;">Text</span><span style="color: blue;">="Label" </span><span style="color: red;">CssClass</span><span style="color: blue;">="HomePage"></</span><span style="color: red;">asp:Label</span><span style="color: blue;">></span></span></pre></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Events of Label</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><b style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: x-large;"><br />
</b><br />
<b style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: x-large;">Init Event:</b></div><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the page has been initialized.During page initialization, controls on the page are accessible and each control's UniqueID property is set. A master page and themes are also applied to the page if required. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.</span><br />
<span style="color: blue; font-family: Consolas;"><br />
</span><br />
<span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Label1_Init(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Here you can write your logic...<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal"><o:p></o:p></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: large;">Load Event:</span></h1><div><span style="font-family: Arial, Helvetica, sans-serif;">This event fires when the web page has been loaded.During load, the opposite happens to the Init Event, all the postback data has been set and all the controls are ready and can fire their different events. The top container, the content page loads first as it can change the master page and user controls, then the master page and in the end the leaf controls.</span></div><div><span style="font-family: 'Segoe UI', sans-serif;"><br />
</span></div><div><div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Label_Load(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Here You can write your code.<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br />
</div></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Methods of Label</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b><br />
</b></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: large;">Focus Method:</span></h1><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="font-family: 'Segoe UI', sans-serif;"><span style="font-size: small;">How to Set Focus on Asp.Net ?</span><span style="color: #3f529c; font-size: 21pt;"><o:p></o:p></span></span></h1><div class="MsoNormal">Label1.Focus() method is use to set the control on a Label.Focus method is helpful to reduce the use of mouse and user can easily get a control by using keyboard.<br />
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;"><br />
</b><br />
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;">AT Server Side : </b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="color: #e66a38; font-family: 'Segoe UI', sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Page_Load(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, EventArgs e)<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Label1.Focus();<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: x-small;"><br />
</span><br />
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;">At Client Side:</b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="font-family: 'Segoe UI', sans-serif; font-size: x-small;"><b><br />
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><%@ Page Language=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"C#"</span><span style="font-family: Consolas; font-size: 10pt;"> %><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><html><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><head runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;">><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <title>Test Page</title><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></head><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <form id=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"form1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;"> defaultfocus=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"TextBox1"</span><span style="font-family: Consolas; font-size: 10pt;"> ><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <asp:Label ID=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"Label1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;">></asp:Label><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <asp:Button ID=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"Button1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;"> Text=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"Button"</span><span style="font-family: Consolas; font-size: 10pt;"> /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </form><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></html><o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Databind() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Label.Databind() binds the datasource to the invoked server control and all its child controls.</span><br />
<span style="font-family: Consolas; font-size: 10pt;"><br />
</span><br />
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Dispose() Method:</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Label.Dispose() enables a server control to perform a final cleanup before it is released from memory.</span></div><br />
To see more properties about Label click on following link:<br />
<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.aspx">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.label.aspx</a> <br />
<span style="background-color: white; color: blue; font-family: Consolas; font-size: 13px;"><br />
</span><br />
<br />
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-33806629436847844172012-05-07T23:36:00.008-07:002012-07-07T09:19:01.748-07:00Textbox<div dir="ltr" style="text-align: left;" trbidi="on"><b style="font-size: x-large; line-height: 18px;">How to Use a Textbox in Asp.Net:</b><br />
<div class="MsoNormal"><div class="MsoNormal" style="line-height: normal;"><b><span style="line-height: 18px;"><span style="font-size: large;"><br />
</span></span></b></div><div class="MsoNormal" style="line-height: normal;"><span style="line-height: 18px;">Textbox is mostly used to take input from a user. e.g; user name,address etc.<span style="font-size: small;"><o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal;"><span style="line-height: 18px;">To use a textbox first open toolbox and double click on Textbox or drag it to web page.<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal;"><span style="line-height: 18px;">Then the following text will be appear on your web page.<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"><span style="font-family: Consolas; font-size: 9.5pt;"> </span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"><span style="font-family: Consolas; font-size: 9.5pt;"><span style="color: blue;"> <</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">TextBox</span> <span style="color: red;">ID</span><span style="color: blue;">="TextBox1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">TextBox</span><span style="color: blue;">></span><o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: 0.0001pt;"><br />
</div><div class="MsoNormal" style="line-height: normal;"><span style="line-height: 18px;">In the previous text<span style="font-size: small;"> ID is used to set identifier for your tag. Remember that asp tags is by default runat server if you will remove runat server then asp tag will not be execute.<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal;"><span style="line-height: 18px;">Now run the file you will see a textbox will be placed on your website.<o:p></o:p></span><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/5MxCTaCTcWU?feature=player_embedded' frameborder='0'></iframe></div><span style="line-height: 18px;">
</span></div><div class="MsoNormal"><div class="MsoNormal"><div class="separator" style="clear: both; text-align: left;">
</div></div><div class="MsoNormal"><span style="font-size: large;"><b>Some Useful Properties of Textbox:</b></span>
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>ID Property:</b></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Textbox.ID property id used to set the ID of textbox control.</span>
<span style="font-family: Arial, Helvetica, sans-serif;">
</span>
<span style="color: blue; font-family: Consolas; font-size: 10pt;">protected</span><span style="font-family: Consolas; font-size: 10pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10pt;">void</span><span style="font-family: Consolas;"><span style="font-size: x-small;"> Page_Load(</span></span><span style="color: blue; font-family: Consolas; font-size: 10pt;">object</span><span style="font-family: Consolas; font-size: 10pt;"> sender, System.EventArgs e)</span>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">{<o:p></o:p></span>
<span style="font-family: Consolas;"> // Set a ID to a Textbox</span>
<span style="font-family: Consolas;"> textbox1.ID = "txtUserName";</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">}</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div>
<span style="color: blue; font-size: large;"><b>Text Property:</b></span>
We can get value from textbox by using <b>TextboxName.Text</b> property and set a value to textbox by using <b>TextboxName.Text </b>property.For example</div><div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 10pt;">protected</span><span style="font-family: Consolas; font-size: 10pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10pt;">void</span><span style="font-family: Consolas;"><span style="font-size: x-small;"> Page_Load(</span></span><span style="color: blue; font-family: Consolas; font-size: 10pt;">object</span><span style="font-family: Consolas; font-size: 10pt;"> sender, System.EventArgs e)</span>
<div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">{<o:p></o:p></span>
<span style="font-family: Consolas;"> // Get a value from Textbox</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> string userName = TextBox1.Text;<o:p></o:p></span>
<span style="font-family: Consolas;"> //Set a value to Textbox</span>
<span style="font-family: Consolas;"> textbox.Text = userName;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><span style="color: blue; font-family: Consolas; font-size: 10pt;">protected</span><span style="font-family: Consolas; font-size: 10pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 10pt;">void</span><span style="font-family: Consolas; font-size: 10pt;"> Button1_Click(</span><span style="color: blue; font-family: Consolas; font-size: 10pt;">object</span><span style="font-family: Consolas; font-size: 10pt;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox2.Text = TextBox1.Text;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;">
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"></div><div class="MsoNormal" style="margin-bottom: 7.5pt;"><span style="font-size: large;"><b><span style="color: blue; font-family: Arial, Helvetica, sans-serif;">Readonly Property:</span> </b></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Textbox.Readonly property set the textbox behaviour as readonly.Inother words user can only see the contents and can't modify but still copy the contents of a textbox.Initially textbox.Readonly property set to false;</span>
<div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox2.Readonly = true;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Enabled Property:</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">Textbox.Enabled property anable the state of textbox control.It is similar to Readonly property but the difference is that you can copy the contents by Readonly property but with Enabled property you even can't copy the contents.Initially its value is true.</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox2.Text = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Textmode Property:</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">Gets or Set the behaviour mode of a textbox such that Songleline, Password, Multiline;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif;">
</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox1.Text = "Singleline"<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Visible Property:</b></span></div></div></div>
<span style="font-family: 'Segoe UI', sans-serif;">Textbox.Visible property is used to set the visiblity of a textbox.If its value is true then textbox will be visible otherwise it will be hide for user.</span>
<span style="font-family: 'Segoe UI', sans-serif;">
</span>
<div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox1.Text = false;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Height & Width Property of Textbox:</b></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;">You can use the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Height</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property along with the </span><b class="bterm" style="background-color: white; line-height: 20px; text-align: -webkit-auto;">Width</b><span style="background-color: white; line-height: 20px; text-align: -webkit-auto;"> property to size an object to specific dimensions.</span></span>
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;">
</span>
<div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Button1_Click(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox1.Height = 100px;<o:p></o:p></span>
<span style="font-family: Consolas;"> Textbox1.Width = 100px;</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><br class="Apple-interchange-newline" /></div>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Events of Textbox</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>
</b></span></div><span style="font-family: 'Segoe UI', sans-serif;"><span style="color: blue; font-size: large;"><b>TextboxChanged Event:</b></span></span>
<span style="font-family: 'Segoe UI', sans-serif;"><b>How to Respond to Changes in a TextBox ?</b></span>
<span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">By default, the<span class="apple-converted-space"> </span><b>Tex</b></span><b style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">tChanged</b><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">event does not immediately cause the Web Forms page to be post back to the server. Infact, the event is raised in webserver code the next time the form is posted. To have the</span><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><b style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">TextChanged</b><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">event cause an immediate posting, set the</span><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><b style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">TextBox</b><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">control's</span><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> <b>Autopostback</b></span><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">property to</span><span class="apple-converted-space" style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;"> </span><b style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">true</b><span style="font-family: 'Segoe UI', sans-serif; font-size: 10pt;">.</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> TextBox1_TextChanged(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, EventArgs e)<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Label1.Text = TextBox1.Text;<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal">
</div><div class="MsoNormal"><o:p></o:p></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: large;">Load Event:</span></h1><div><span style="font-family: 'Segoe UI', sans-serif;">This event fires when the web page has been loaded.</span></div><div><span style="font-family: 'Segoe UI', sans-serif;">
</span></div><div><div class="MsoNormal"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Textbox1_Load(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, System.EventArgs e)</span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> Here You can write your code.<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;">
</div></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Some Useful Methods of Textbox</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>
</b></span></div><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="color: blue; font-family: 'Segoe UI', sans-serif; font-size: large;">Focus Method:</span></h1><h1 style="margin-bottom: 7.5pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;"><span style="font-family: 'Segoe UI', sans-serif;"><span style="font-size: small;">How to Set Focus on Asp.Net ?</span><span style="color: #3f529c; font-size: 21pt;"><o:p></o:p></span></span></h1><div class="MsoNormal">Textbox.Focus() method is use to set the control on a Textbox.Focus method is helpful to reduce the use of mouse and user can easily get a control by using keyboard.
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;">
</b>
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;">AT Server Side : </b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="color: #e66a38; font-family: 'Segoe UI', sans-serif; font-size: x-small;"><b>
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="color: blue; font-family: Consolas;">protected</span><span style="font-family: Consolas;"> </span><span style="color: blue; font-family: Consolas;">void</span><span style="font-family: Consolas;"> Page_Load(</span><span style="color: blue; font-family: Consolas;">object</span><span style="font-family: Consolas;"> sender, EventArgs e)<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;">{<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas;"> TextBox1.Focus();<o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Consolas;">}<o:p></o:p></span>
<span style="font-family: Consolas; font-size: x-small;">
</span>
<b style="background-color: white; font-family: 'Segoe UI', sans-serif; font-size: small;">At Client Side:</b></div><div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; vertical-align: baseline;"><span style="font-family: 'Segoe UI', sans-serif; font-size: x-small;"><b>
</b></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><%@ Page Language=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"C#"</span><span style="font-family: Consolas; font-size: 10pt;"> %><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><html><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><head runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;">><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <title>Test Page</title><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></head><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"><body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <form id=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"form1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;"> defaultfocus=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"TextBox1"</span><span style="font-family: Consolas; font-size: 10pt;"> ><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <asp:TextBox ID=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"TextBox1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;">></asp:TextBox><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <asp:Button ID=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"Button1"</span><span style="font-family: Consolas; font-size: 10pt;"> runat=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"server"</span><span style="font-family: Consolas; font-size: 10pt;"> Text=</span><span style="color: #a31515; font-family: Consolas; font-size: 10pt;">"Button"</span><span style="font-family: Consolas; font-size: 10pt;"> /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> <br /><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </div><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"> </form><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></body><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 9pt; word-break: break-all;"><span style="font-family: Consolas; font-size: 10pt;"></html><o:p></o:p></span>
<span style="font-family: Consolas; font-size: 10pt;">
</span>
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Databind() Method:</b></span>
<span style="font-family: Arial, Helvetica, sans-serif;">
</span>
<span style="font-family: Arial, Helvetica, sans-serif;">Textbox.Databind() binds the datasource to the invoked server control and all its child controls.</span>
<span style="font-family: Consolas; font-size: 10pt;">
</span>
<span style="color: blue; font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Dispose() Method:</b></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Textbox.Dispose() enables a server control to perform a final cleanup before it is released from memory.</span>
<span style="font-family: Arial, Helvetica, sans-serif;">This video tutorial defines how to use textbox with different styles:</span>
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/bsHoEDNZapg?feature=player_embedded' frameborder='0'></iframe></div><span style="font-family: Arial, Helvetica, sans-serif;">
</span>
To see more properties about textbox click on following link:</div><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx</a>
<div class="separator" style="clear: both; text-align: center;">
</div>
</div><div class="MsoNormal"><span style="font-size: large;"><span style="line-height: 18px;">
</span></span></div><div class="MsoNormal"><span style="font-size: large;"><span style="line-height: 17px;">
</span></span></div></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8878236359374401320.post-76641398671116796852012-05-05T11:36:00.003-07:002012-06-22T04:04:44.074-07:00How to Create New Project?<div dir="ltr" style="text-align: left;" trbidi="on">Today i m going to tell you how to create a new Dot Net Project ....<br />
<b><br />
</b><br />
<b>For creating a new Windows Application Project follow these steps:</b><br />
<b>Step I:</b><br />
First go to <b>start->All Programs->Microsoft Visual Studio</b>,then Visual Studio will be open.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh25duBtVmutHmLVZXn99Qq8XbVrHYt9arKKxh8crJw2wIsXk5_EOcr_dh66JuvEepgk2Cgl8EpTTchgmut6D8hEwMY0sYeFgemn_0HgxrBGat80ER9zC5q5jHIq2zQJEXsJrXAfByyg1CC/s1600/Image.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh25duBtVmutHmLVZXn99Qq8XbVrHYt9arKKxh8crJw2wIsXk5_EOcr_dh66JuvEepgk2Cgl8EpTTchgmut6D8hEwMY0sYeFgemn_0HgxrBGat80ER9zC5q5jHIq2zQJEXsJrXAfByyg1CC/s320/Image.png" width="320" /></a></div><br />
<b>Step II:</b><br />
Go to <b>File ->New->Project.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDk3XiA0P3kTkgaLvqFSYR-THCXpcgpISY1tRatQ7-JxAcoG-xYD0M8surroK4LzGiZOn6DX8Hv6zHfHvz5uUx5Yu8-xhxugoTjJd_AhlbvNx_eaeprluFVxz14MdSDY_zaomvV6PGBg7q/s1600/VS-New+Project-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDk3XiA0P3kTkgaLvqFSYR-THCXpcgpISY1tRatQ7-JxAcoG-xYD0M8surroK4LzGiZOn6DX8Hv6zHfHvz5uUx5Yu8-xhxugoTjJd_AhlbvNx_eaeprluFVxz14MdSDY_zaomvV6PGBg7q/s320/VS-New+Project-1.png" width="320" /></a></div><br />
After that new form will be open.Enter the name of New Project and its location ans clock on <b>Save</b> button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUhKx3fPikk8ROVByATSWFQBide1iSjfFXSkCwRyoPT79Gjqm9qajOoWqk94dhxiBUj0qhVCPIe1zX0ub20BpNZZSOfc2ZJM7NUwFDNmlPQfSJ5xNmX_ArfP4mYgw_-ECLHw12LeCiMPMV/s1600/VS-New+Project-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUhKx3fPikk8ROVByATSWFQBide1iSjfFXSkCwRyoPT79Gjqm9qajOoWqk94dhxiBUj0qhVCPIe1zX0ub20BpNZZSOfc2ZJM7NUwFDNmlPQfSJ5xNmX_ArfP4mYgw_-ECLHw12LeCiMPMV/s320/VS-New+Project-2.png" width="320" /></a></div><br />
<b>For creating a new Web base Project follow these steps:</b><br />
<b>Step I:</b><br />
<br />
First go to <b>start->All Programs->Microsoft Visual Studio</b>,then Visual Studio will be open as previously discussed.<br />
<b>Step II:</b><br />
Go to <b>File->New ->Website.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrKCQOmL88UPsjq_PwGX9Rf1FBR3jkREm54F0YawsYoIQCBzxb6LTlNqCQiKxX2Ewn4GJaF9NXvq3UZTZeAZcYu9l20KcAPeHNkHztwOIgUXD3dHPaaGoqK0_Yg74LZ0Rk52GiwkDKf-5X/s1600/asp-New+Project-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrKCQOmL88UPsjq_PwGX9Rf1FBR3jkREm54F0YawsYoIQCBzxb6LTlNqCQiKxX2Ewn4GJaF9NXvq3UZTZeAZcYu9l20KcAPeHNkHztwOIgUXD3dHPaaGoqK0_Yg74LZ0Rk52GiwkDKf-5X/s320/asp-New+Project-1.png" width="320" /></a></div><br />
<br />
<span style="font-size: large;">OR</span><br />
<b>Step I:</b><br />
<br />
First go to <b>start->All Programs->Microsoft Visual Studio</b>,then Visual Studio will be open.<br />
<b>Step II:</b><br />
Go to <b>File->New ->Project->Web.</b><br />
<br />
After that <b>Save As </b>form will be open.Enter the name of New Project and its location ans clock on <b>Save</b> button.After click Save Button your new created project will be load.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim4ACVLgCR9PtSz7CkBMTsNgN0mIcBoNIegvcshnOlTYy20nHdidJwxSko2WWvswGak-G6aq7BqzUFbwFkCB-mDJO-sAuzHESlSBVrA12HA9B6XMPiGQrz1neI0R-JCQIKXIjOeTsMBUJp/s1600/asp-new+created+project.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim4ACVLgCR9PtSz7CkBMTsNgN0mIcBoNIegvcshnOlTYy20nHdidJwxSko2WWvswGak-G6aq7BqzUFbwFkCB-mDJO-sAuzHESlSBVrA12HA9B6XMPiGQrz1neI0R-JCQIKXIjOeTsMBUJp/s320/asp-new+created+project.png" width="320" /></a></div><br />
<br />
<br />
<br />
<b><br />
</b><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/GWqO406Mh6Q?feature=player_embedded' frameborder='0'></iframe></div><b><br />
</b></div>Unknownnoreply@blogger.com0