Posted on November 24th, 2015 by Devi Das
There are different ways in which you can create dynamic control in ASP.NET. Here i have given 5 different ways for creating Dynamic controls. 1 : [By using JavaScript] —————————— By using javascript you can create Dynamic controls. Code : window.load = createDynamicControl; function createDynamicControl() { document.write(“<input […]
Posted on November 23rd, 2015 by PANKAJ DEY
The cookies are carrying sensitive information like session ID with HTTP Request. This cookies can be easily access through javascript or api or applets.. and the worst thing If it passes through unencrypted channel this can be sniff on the network also.. Here the configuration We can add to web config for secure cookies. <system.web> […]
Posted on November 23rd, 2015 by Prasanti Prusty
In ErrorLog we need to keep track of the File and the Function details where this Exception occurs. So, instead of sending the Hardcoded Values (i.e : Function Name , File Name ) to ErrorLog, we can directly get this details from Exception object (i.e : Exception ex) as follows : Use namespace : using […]
Posted on November 23rd, 2015 by Dukhabandhu Sahoo
Sometimes we need to find a control from Wizard navigation steps. For that we need to use FindControl() method but we fail in this case, as we always get null when using WizardId.FindControl(“ControlId”). Why? Because when ASP.NET adds the navigation area controls to the wizard control, it adds a prefix onto the control name. So […]
Posted on November 23rd, 2015 by Bhagirathi Panda
The PageMethods feature enables the using of code-behind page methods on the client side. This is easier and reliable to use and the main feature is it automatically validates the page parameters. Page Method Example ASPX <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”PageMethods.aspx.cs” Inherits=”PageMethods” %> <!DOCTYPE html> <html xmlns=”http://www.w3.org/1999/xhtml”> <head id=”Head1″ runat=”server”> <title></title> <script type=”text/javascript”> function AccessServerSide() […]
Posted on November 23rd, 2015 by Dukhabandhu Sahoo
In current web applications, sending email from template with dynamic content is a common requirement. To achieve this we add a template and we add some parameters which need to be replaced dynamically in the template. Let’s say we have user reset password email template like: Hello <%UserName%>, <p>Your username: <%UserName%></p> <p>Your new, reset password […]
Posted on November 23rd, 2015 by Suraj Sahoo
Recently going through the Exception handling and logging, I found an interesting topic which I would like to share. “Exceptions”, family member to every language/technology used.These are sometimes irritating for the developers. If its irritating for developers what would be the condition of the end user when he/she views the “yellow screen populated with God […]
Posted on November 23rd, 2015 by Smruti Sahoo
In Kentico CMS all information related to the documents are saved inside the database in many joined tables. The tables used for storing document records are as follows : CMS_Tree – This table stores the information about the tree structure of the website document content and contains one record for all culture versions for the […]
Posted on November 23rd, 2015 by Aditya Acharya
What : A loosely typed programming languages is typically one that does not require the data type of a variable to be explicitly stated. Example : As in JavaScript we can declare var count = 1; which will automatically treat variable count as integer. Advantage: The advantage of loosely typed is that we don’t have […]
Posted on November 23rd, 2015 by Narendra Mallik
Sometimes we need to run some system commands from within our program. In such cases the following example can be helpful. <%– Button in aspx file –%> <asp:Button ID=”btnCommand” runat=”server” Text=”Button” onclick=”btnCommand_Click” /> If you click on the button the following event handler will be called and the command line interface would be […]
Posted on November 23rd, 2015 by Sukant Shekhar
Challenge: I was given a scenario in which i need to represent a large number by few character it must be hard to break the code. For ex: A 8 digit number into 5-6 character. That too uniquely identified per number (i.e code corresponding to each number should not match the code corresponding to different […]
Posted on November 23rd, 2015 by Priyojit Mondal
Disposing of object is necessary thing after the job is done, but we hardly take care of this fact. In recent scenario, it hardly mater any space consumption if we don’t dispose any object. But there are some cases where, if you ignore the disposition thing, your life could be hell. One among them is […]
Posted on November 23rd, 2015 by Santosh Bisoyi
What is a Cookie ? A Cookie is an object is used to store the sort amount of data onto client end. It executes on server and resides on client browser. How does Cookie work ? when users request a page from your site, your application sends not just a page, but […]
Posted on November 23rd, 2015 by Santono Patra
While working in ASP.NET, you often come across a need to display serial number or Auto-number in a Gridview control. This can be accomplished by adding the Container.DataItemIndex in the html markup of the Gridview control. Below is the sample code: <asp:GridView ID=”GridView1″ AutoGenerateColumns=”false” runat=”server”> <Columns> <asp:TemplateField HeaderText=”Record Number”> <ItemTemplate> <%# Container.DataItemIndex + 1 %> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField=”customerid” HeaderText=”customerid” […]
Posted on November 23rd, 2015 by Srikanta Barik
Accessing the control’s id at runtime, when the page being used is the master page, has been a persistent issue, especially when we are trying to access the control’s id(Client Id) using Javascript. When we are adding the content to our aspx page, it resembles : <asp:Content ID=”Content1″ ContentPlaceHolderID=”MindfireContent” Runat=”Server”> <asp:Textbox ID=”txtMindfire” runat=”server” Text=”Proud to be Mindfireans” /> […]
Posted on November 23rd, 2015 by Deepak Mishra
Working With LeadTools in Web Application Basically LeadTool is third party tool used for Image processing. LeadTools is used to display image on window application. If we want to use LeadTool in our web application then it needs to be used as an ActiveX controls first we need to make an ActiveX control. While making […]
Posted on November 23rd, 2015 by Jnana Swain
If Asp.net Ajax framework is used, web service and WCF service methods are consumed by ScriptManager. For jQuery framework, these services are consumed by following ways. Example: Create Ajax-EnabledWCFService, name it “TimeService.svc”. Put Following code in the TimeService class. [OperationContract] public string GetTime() { return “<B>” + “Current Server Time : ” + DateTime.Now.ToLocalTime() + “</B>” ; } ASPX Page <script […]
Posted on November 23rd, 2015 by Smruti Sahoo
At times we face situations in which we may have a big string containing the html tags in it and we need to remove the tags from the text to get the appropriate string as text. We can do it very easily using regular expression comparision as mentioned in the below example :- Example :- […]
Posted on November 23rd, 2015 by Ashish Kumar
While working with the repeater control I found myself in a scenario where I have a button in the repeater for every column and on the click of that button I need to change the color(highlight) of that row. It’s a very usual case where we need to prepopulate some controls from the databound controls […]
Posted on November 23rd, 2015 by Soumya Patnaik
Set the Zoom percent to 100% in the page. <body runat=”server” id=”Body” style=”zoom: 100%”> </body> Use this Javascript function to set the zoom in and zoom out to 10% for the page function zoomIn() { var Page = document.getElementById(‘Body’); var zoom = parseInt(Page.style.zoom) + 10 +’%’ Page.style.zoom = zoom; return false; } function zoomOut() { […]
Posted on November 23rd, 2015 by Sabitree Sahu
Selecting all checkboxes by selecting the checkbox in the header of the gridview is a common operation in ASP.NET applications. We could do the same thing but writing less code and giving less effort by using JQuery. The following code is used to perform the SelectAll / DeSelectAll function. <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js”></script> <script type=”text/javascript”> function […]
Posted on November 23rd, 2015 by Anita Bhanja
You may have seen ‘back to top’ link to take the user to top of the page. There are two ways to do it. 1. Giving the position to (0,0) through javascript. <a href=”javascript:scroll(0,0)”> Back to top </a> You can specify any position by x- and y- coordinate to scroll to particular position in the […]
Posted on November 23rd, 2015 by Swaraj Gochhayat
Often we deal with XML content/files in our projects, for read/write/parse/save/delete etc.. operations. The two classes that will come handy in this case are XDocument and XmlDocument. XDocument is what we know as the extended version of XmlDocument which was the standard DOM-Style API for XML whereas the former is the LINQ to XML API. […]
Posted on November 23rd, 2015 by Bhagirathi Panda
To access Google Drive Content we requires two things 1.Refresh Token 2.Access Token(Valid for only one hour) 1.First get the Refresh Token Id to access Google Drive APIOffline. How To Get Refresh Token ID? -First get Client id and Client Secret by registering you app for api access in Google APIs Console. -Login URL : […]
Posted on November 23rd, 2015 by Sathyan R
Background: When a website, which requires some one to login is opened in IE7 and when links from the website are opened in new tabs, the session from the original tab will carry forward to the new tab. The same feature, functionality, or bug, whatever you may call it is now carried forward to IE8 […]
Posted on November 23rd, 2015 by Rupesh Nayak
If you use Response.Redirect or Server.Transfer in your code then aThreadAbortException occurs and the response is ended/aborted immediately. You can set an extra parameter as false in these calls to avoid the thread-abort exception. For example, the line: Response.Redirect(“Myworld.aspx”) //your response will be aborted can be rewritten as this to solve the ThreadAbortException problem: Response.Redirect(“Myworld.aspx” […]
Posted on November 23rd, 2015 by Rupesh Nayak
Automatic web page refresh can be implemented in an ASP.NET (.aspx) web-page by adding some HTML code in the header section. You can simply add following line of code in the Header section to enable auto refresh in an ASP.NET web page. <meta http-equiv=“refresh“ content=”15“> Where 15 refers to the number of seconds it will […]
Posted on November 23rd, 2015 by Rupesh Nayak
If your application targets different user-groups, you may feel the need to customize the layout of the page to display group-specific visual interface. This can be achieved by using customized CSS files that are added dynamically. You can add CSS files in to ASP.NET webpages dynamically. Let me show you how. Add following HTML tag […]
Posted on November 23rd, 2015 by Satyadeep Kumar
How to Change Heading, Title of a Master Page depending upon the content page? (Without any additional ContentPlaceHolder ) MasterPages give a consistent look to cur web application. Whole data of content pages are available inside the ContentPlaceHolder, and the remaining portion of the MasterPage remains consistent. What if we require to change the TitleText,TitleImage of Master Page (based […]
Posted on November 23rd, 2015 by Amit Pratihari
Here are some points regarding increase the performance of Asp.net Applications 1. Uses of Connection pooling 2. Using DataReader Over DataSet/DataTables 3.Executing SELECT statements at a time 4.Make DataSourceMode to DataReader while using SqlDatasourcecontrol Few Tips to Increase the performance in Asp.net Applications 1..Uses of Connection pooling— Opening the connection in the database is a […]
Posted on November 23rd, 2015 by Surama Hotta
XmlTextWriter Class allows you to Write XML to a file.You can use the inbuilt properties and methods of the XmlTextWriter class to create a xml file. XmlTextWriter Class provides a way to generating a XML Document/File. 1. Create a XmlTextWriter Object. 2. Pass the Xml File name and encoding type parameter through the Object.If encoding parameter […]
Posted on November 23rd, 2015 by Monalisa Brahma
We all are quite acquainted with the term Master page in ASP.NET which was first introduced in VS 2005 and continues to make development easier. Here is a Tip which adds one more point to more effectively use MasterPage.. In order to Avoid Master Page Postback i.e only to refresh the content within ContentPlaceholder, we need to do […]
Posted on November 23rd, 2015 by Jnana Swain
If tooltip property of datagrid cell is used (e.Item.Cells[0].ToolTip), tooltip will be shown but large text may not be well truncated. i.e the characters may not be fully padded up to the last pixel of cell, it may be truncated at the middle of the cell or any where in the cell. Item Bound DataRowView rowview = […]
Posted on November 23rd, 2015 by Jnana Swain
In Datagrid [or] GridView Paging when last page contains less number of records than the page size, the pager will move upward. Example:- Datagrid PageSize = 15 and 75 records are returned from DB, then pager will show 5 pages. If 70 records are returned, pager will show 5 pages and if the4th ( last page) page is clicked pager will […]
Posted on November 23rd, 2015 by Monalisa Pradhan
After having successfully logged-in to an application, you are redirected to the next page (say Home.aspx) which is a content page of master page (say Master.master). In this master page you have a link for logout. When you click on the logout button it redirects you to the Login page (provided this is not the […]
Posted on November 23rd, 2015 by Monalisa Brahma
We have different methods to maintain the design standard (style for server controls) in a .NET application. For instance, We can do it by using Theme – by assigning the name of Theme File In each page or We can once set it in Web.config file We can also do it by applying css to every page. […]
Posted on November 23rd, 2015 by Surama Hotta
We generally use a GridView Control to Display Data and also Perform Paging, Sorting, Editing, Deleting records. In each of these we have postback on the page. To avoid Postback during sorting and Paging, the following code can be used inside the GridView Control. If you have created a GridView and Bind the GridView using […]
Posted on November 23rd, 2015 by Aditya Acharya
While providing the user with something to input free text in, sometimes you may need to go beyond the normal text area. For example, you may need to give the user the flexibility to better format their input and insert a smiley There are many Rich Text Editors (RTEs) available for this purpose. Many […]
Posted on November 23rd, 2015 by Satyadeep kumar
We use gridview to view data in tabular format on the web page. If the web page is not reloaded for some time, and somedata manipulation(insert/update/delete) occurs at backend, then the viewer is presented with older(wrong) data. So, there is a need to refresh the content of grid-view regularlywithout any user input (page postback). First, […]
Posted on November 23rd, 2015 by Jnana Swain
Datagrid row highlighted function can be written in asp.net as: – ItemCreatede.Item.Attributes.Add(“onmouseover”, “this.style.backgroundColor = ‘lightblue’;”); e.Item.Attributes.Add(“onmouseout”, “this.style.backgroundColor = ‘white’;”); Datagrid renders as a table so this functions is added on every row basis. Using JQuery query-1.2.5.js ->Download it from http://www.jQuery.com jquery.stripy.js -> Download it fromhttp://www.easyjquery.com/examples/jquery-plugin-stripy.zip aspx code:- <head runat=”server”> <title>Untitled Page</title> […]
Posted on November 23rd, 2015 by Mritunjay Kumar
A number of times we come across multiple collapsible panels in a single page. To call different javascript functions on collapse and expand events of collapsible panels, you can follow these steps: Add a BehaviorID to the CollapsiblePanelExtender. Use javascript functions to hook onto the Expand and collapse events. Example: function pageLoad(sender,args) { $find(“collapsibleBehavior”).add_expandComplete( […]
Posted on November 23rd, 2015 by Santono Patra
Using parameterized SQL queries to help prevent SQL injection attack. If you are not new to web development in particular, it is quite likely that you already know what a SQL injection is and how it poses threat to your system security. This is more probable when you are adding strings to SQL commands. string sql = “SELECT * FROM tblUser WHERE […]
Posted on November 23rd, 2015 by Satyadeep Kumar
Suppose, in a web application we need to create some files (say xml reports) and then show it to the user. One of the simpler ways to view those files would be through a popup() page. This is what is explained below: Solution: Let our web application display XML files from a specific directory location (say “C:\XML Files”) […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
ObjectDataSource is one of the data source controls in ASP.NET.It allows us to bind DataBound Controls(GridView,DetailView,FormView etc). Most data source controls provide a two-tiered application architecture, where the presentation layer ie the User Interface interacts directly with the backend data provider.How ever to encapsulate data retrieval, an additional layer between the presentation page and data provider […]
Posted on November 23rd, 2015 by Rashmita Devi
If you have used the DevExpress GridView, during Windows Application development, you are likely to have come across a column with aColumnEdit of type “HyperLinkEdit”. If you want to set the RepositoryItemfor that column during runtime according to the value of another column then you have to handle the GridView’s CustomRowCellEdit event. Refer the following code : private void gridview1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) { […]
Posted on November 23rd, 2015 by Saroj Dash
Recently, I have had to face a problem while consuming a web service from my .NET application and would like to share the problem as well as the solution with others. The error message I received said: “The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel”. As I later found out, this error occurs […]
Posted on November 23rd, 2015 by Mritunjay Kumar
This is a small but useful trick that I recently came across. We can set the properties of a server control according to the browser without writing a single line of javascript. Let’s check out some code samples: Label control: <asp:Label ID=”lblTest” runat=”server” ie:CssClass=”IEStyle” mozilla:CssClass=”FFStyle” CssClass=”DefaultStyle” ie:Text=”You are in Internet explorer.” mozilla:Text=”You are in Firefox.” […]
Posted on November 23rd, 2015 by Devi Das
When using HTML we can use <meta> tag to continuously Refresh a page afer a time Interval. <meta http-equiv=”refresh” content=”5“/> Here 5 indicates Seonds after which the Page will get Refreshed. We can use this tag in Asp.NET to Refresh our Page conditionally. Only we have to add two more attributes 1. ID 2. runat=”server” by which […]
Posted on November 23rd, 2015 by Anita Bhanja
Improving the performance of your ASP.NET Web application through output caching !!! Page level Caching is a technique to store output of a request sent to the page, which helps to increase the performance of application. Data can be fetched from previous cache memory instead of processing the request again. Following is the directive you […]
Posted on November 23rd, 2015 by Bibhuti Chanda
By default ListView does not maintain state of check boxes inside it. Suppose you are having checkboxes inside each item in ListView and a DataPager control to show all the records in page wise manner.Now, if you check some boxes on a page, go to another and come back to the same page, you will find that the checkboxes […]
Posted on November 23rd, 2015 by Rashmita Devi
If you need to customize the Group Text during runtime then you can handle the GridView’s CustomDrawGroupRow event. Let’s say you have a GridView and you are grouping the data according to Project Number. But while showing the group text you want to show both Project Number and Project Name (ex. 001 – Demo Project). Where ‘001’ […]
Posted on November 23rd, 2015 by Jnana Swain
The following code snippet demonstrates how you can add an event handleras well as a CSS class to an element using ScriptManager. Sys.UI.DomEvent class provides API for attaching handlers to DOM element. Sys.UI.DomElement class provides API and Properties for manupulating DOM elements. Adding Event:- <asp:ScriptManager ID=”smEventHandling” runat=”server” /> <asp:Button ID=”btnAddEventType1″ runat=”server” Text=”AddEventHandlerType1″ /> <asp:Button ID=”btnAddEventType2″ […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
To dynamically create an instance of User Control we have to use Page.LoadControl () method which returns an instance of the Control class. And also the PlaceHolder control which acts as a container of controls. Below is the code to show all the User Controls present in Application’s UserControls folder in a single web page. […]
Posted on November 23rd, 2015 by Navin Sangla
This tip demonstrates how you can bind GridView with an array Datasource. //Binding gridview with array data source ArrayList arrayDataSource= new ArrayList(); arrayDataSource.Add(new ListItem(“http://www.asp.net”)); arrayDataSource.Add(new ListItem(“http://www.microsoft.com”)); arrayDataSource.Add(new ListItem(“http://www.dotnetcurry.com”)); arrayDataSource.Add(new ListItem(“http://www.devcurry.com”)); Gridview1.DataSource = arrayDataSource; Gridview1.DataBind(); //Code for .aspx Page <asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”false”> <Columns> <asp:TemplateField> <ItemTemplate> <asp:TextBox ID=”Textbox1″ Text = ‘<%# Container.DataItem %>’ runat=”server”> </asp:TextBox> […]
Posted on November 23rd, 2015 by Tejaswini Das
There may be scenarios where we require to create a comma-separated string from collection of objects. The type of collection often varies: it may be a DataTable from which we need a certain column, or a List of a class. One of the common approaches followed for achieving this is looping through the datatable or array of […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
To set the focus on a particular record of a DevExpress GridView we have to set theFocusedRowHandle property .We can get the RowHandle of the GridView by passing the primary key value. Below is the code for finding the RowHandle and setting the FocusedRowHandle property of the GridView. grdvEmployees.FocusedRowHandle = FindRowHandle (1100); In the above line of […]
Posted on November 23rd, 2015 by Santosh Bisoyi
Problem : Basically we use “GroupName” property of radio button control in order to group more then one radio buttons ( i.e. single selection of value from set of radio buttons), but this “GroupName” property does not work when we use radio buttons inside a GridView controls. So there are different solutions for this and […]
Posted on November 23rd, 2015 by Rashmita Devi
To count the number of Active Session(s) we have to handle three events of Global.asax. Application_Start Session_Start Session_End First the Application_Start event will be fired after that Session_Start and then Session_End. The Global.asax file is used to track the number of active sessions. Whenever a new session begins, the Session Start event is […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
We can create our own configuration section in the Web.Config file and can store any value we want to. For creating custom Configuration Section we have to follow the following steps: Define your custom Configuration class which is derived from the base ConfigurationSection class. Define the properties which you want to store in the […]
Posted on November 23rd, 2015 by Devi Das
A very common issue that we come across is duplicate insertion of data on refreshing the page. For instance, , we have a web page with some text boxes and a button which when clicked inserts data into the Database. Now if we have already inserted data and then refresh the page, the record is inserted in the Database once […]
Posted on November 23rd, 2015 by Naveen Saini
We can embed the media player in a web page in many ways. But the easiest and the most straight forward way is to place a literal control on the web page. Then just set the text of the same as mentioned below: Step 1: ‘—Place the Literal control on the web page as mentioned below: […]
Posted on November 23rd, 2015 by Bibhuti Chanda
ASP.NET 3.5 DataPager Control ASP.NET 3.5 introduces a new control named as DataPager. It provides users to create interfaces for navigation through multiple pages containing multiple records within it. DataPager control can work with any control that supports IPageableItemContainer interface. In ASP.NET 3.5 ListView is one and the only control that supports this interface. […]
Posted on November 23rd, 2015 by Santono Patra
Follow the process below to publish content from another URL in a ContentPlaceHolder Control.. <asp:Content ID=”Content1″ ContentPlaceHolderID=”ContentPlaceHolder1″ Runat=”Server”> <asp:Literal runat=server ID=”ltlContent” /> </asp:Content> protected void Page_Load(object sender, EventArgs e) { try { WebRequest wReq = WebRequest.Create(“http://yahoo.com”); WebResponse mRes = wReq.GetResponse(); StreamReader sr = new StreamReader(mRes.GetResponseStream()); string sHTML = sr.ReadToEnd(); sr.Close(); mRes.Close(); if (sHTML != […]
Posted on November 23rd, 2015 by Aditya Acharya
A number of times we require to add some client side Javascript to page dynamically. It will help us to execute the Javascript as and when we want it to use. For this we have to first register the script in the page. There are some ways to add client side script to the page […]
Posted on November 23rd, 2015 by Anita Bhanja
AT the time of page rendering we can either regenerate the page or use information already stored in valid cache. We can validate a cache page through our asp.net code behind. We can decide whether to use a cached version of a page or simply render it as fresh new page. For that we have […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
We can cache dynamically loaded user controls using the following steps. 1. Include <%@ OutputCache %> directive in the user control that is in .ascx file. 2. When a user control is cached, ASP.Net framework wraps the user control as an instance of the PartialCachingControl class. Therefore we need to cast the control returned by the Page.LoadControl […]
Posted on November 23rd, 2015 by Author: Sumit Singh
Some times there is a need to stop multiple asynchronous(AJAX) requests from a single page. If you are using ASP.net Ajax Extensions as your Ajax Framework, then Sys.WebForms.PageRequestManager is the class, that can help you to catch the InitializeRequest and EndRequest events. Now you can add JavaScript functions to these events for disabling controls, showing progress dialogs etc Here […]
Posted on November 23rd, 2015 by Mritunjay Kumar
Some times you may face weird issues in applying of the Asp.net Ajax Controls (like UpdatePanel etc) in case of ASP.net projects, migrated from ASP.net 1.1 to ASP.net 2.0 or 3.5. Issues may be like, Ajax UpdatePanel doing postback synchronously, which is not the expected behavior. Few days back I was stuck with this, and after struggling […]
Posted on November 23rd, 2015 by Madhusmita Rout
If we use the ModalPopupExtender of Ajax Control Toolkit we may run into flickering issue i.e. the content of ModalPopupExtender shows up for a moment during the page load and then disappears, while it should not be displayed on the page load. To solve this problem we have to set up display property ‘none’ on […]
Posted on November 23rd, 2015 by Monalisa Pradhan
Following are some useful tips on Telerik controls. 1.In telerik there are inbuilt skins present for each controls. So if we apply the inbuilt skin then we are unable to use any user defined style. So to add user defined style to rad control first set the following property to false EnableEmbeddedSkins=”false“ 2. If […]
Posted on November 23rd, 2015 by Monalisa Brahma
Add the following in your application to show video (from database) STEP-1 <object id=’player1′ enableviewstate=’false’ classid=’clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6′ visible=’true’ height=’500′ width=’500′><param name=’url’ value=’ShowImage.ashx?id=51’/><param name=’loop’ value=’false’ /> <param name=’showcontrols’ value=’true’ /></object> Here (ShowImage.ashx?id=51′) 51 is taken as only example which is the primary key field of table of which video is to be retrieved. STEP-2 <%@ WebHandler Language=”C#” Class=”ShowImage” %> public class […]
Posted on November 23rd, 2015 by Amit Mohapatra
Most of the time developers register the User Controls to individual asp.net pages where, controls are in use. If the control is in use in most of the pages of the site, the reference can be added at one place only, that is in the web.config. Code to add in web.config file to register the user […]
Posted on November 23rd, 2015 by Monalisa Brahma
Recently I was working with Rad:Calendar in one of my pages when my client said he wants to get rid of the other month dates . After some search I found one property of Rad:calendar asShowOtherMonthsDays and then I made it as false. i.e ShowOtherMonthsDays =”false” It was a good option and to some extent it solved […]
Posted on November 23rd, 2015 by Surama Hotta
Sometimes we need to display specific records in a Grid, instead of displaying all the records. Using following Code in LINQ TO SQL we can display specific records. <asp:GridView ID=”GrdContactNo” runat=”server” AutoGenerateColumns=”False” SkinID=”Grid” /> <Columns> <asp:BoundField DataField=”PK_PRIMARY_KEY” HeaderText=”Primary Key” /> <asp:BoundField DataField=”FIRST_NAME” HeaderText=”First Name” /> <asp:BoundField DataField=”MIDDLE_NAME” HeaderText=”Middle Name” /> <asp:BoundField DataField=”LAST_NAME” HeaderText=”Last Name” […]
Posted on November 23rd, 2015 by Rabinarayan Biswal
HttpForbiddenHandler can be used to restrict access to resources and files from being downloaded through HTTP. Using <httpHandlers> in Machine.config HTTP handlers are responsible for processing Web requests for specific file extensions. We can modify the <httpHandlers> section of Machine.Config file (default path of Mahine.Config file is %windir%\Microsoft.NET\Framework\{version}\CONFIG) to forbid access to any specific file […]
Posted on November 23rd, 2015 by Bibhuti Chanda
In ASP.NET AJAX Control toolkit there is an extender known as SlideShowExtender. This can be used to create a Slide show by looping through the images. The images are shown in the SlideShow by using a PageMethod or a Webservice. Example: <div> /*Add a script manager in your page */ <asp:ScriptManager ID=”ScriptManager1″ runat=”server”> </asp:ScriptManager> […]
Posted on November 23rd, 2015 by Sachin Kumar
Problem In ASP.NET each control has its unique ID. The control ID remains as it is until it is placed directly under “form” tag. But it is not practical . Our control may needed to placed inside a GridView which in turn placed under Update Panel which is in the Master Page. Now the format […]
Posted on November 23rd, 2015 by Devi Das
Progress indicator is something which will give some indication to the user about some Progress. Suppose a Program is fetching some data from DB, then in that case it would be better if we can provide some Visual indications or any custom message to the End-user while fetching data from DB . E.g: Fetching Data…. […]
Posted on November 23rd, 2015 by Aditya Acharya
Each Ajax control & extender is associated with a Javascript file named asBehaviour.js . This file contains those functions which specify the behaviors of these controls and extenders. If we want to customize any behavior of these controls or extenders we can update the source code. But it is not a good option to modify the […]
Posted on November 23rd, 2015 by Satyaprakash Sahu
One workaround is to have a separate table control to show the header elements and hide the actual header of the grid.Now put the grid inside a div or panel with scrollbar property.But that takes extra effort to have a proper alignment.Each cell of the header table should be aligned with each cell of the […]
Posted on November 23rd, 2015 by Surama Hotta
RadDateTimePicker control displays 12 AM as default time. If you want to change this default time following can help you out. <telerik:RadDateTimePicker ID=”RadDate” Runat=”server” Skin=”WebBlue” > <TimePopupButton HoverImageUrl=”” ImageUrl=”” /> <ClientEvents OnDateSelected=”DateSelected” /> <TimeView CellSpacing=”-1″ StartTime=”07:00″ EndTime=”23:00″ Interval=”0:15:0″ Columns=”6″ OnClientTimeSelected=”ClientTimeSelected”></TimeView> <Calendar skin=”WebBlue” UseColumnHeadersAsSelectors=”False” UseRowHeadersAsSelectors=”False” ViewSelectorText=”x”></Calendar> <DatePopupButton HoverImageUrl=”” ImageUrl=”” /> </telerik:RadDateTimePicker> Javascript code: <script […]
Posted on November 23rd, 2015 by Om Pathak
If you need to restore a Sql backup file programmatically through .NET code then you can use the following lines of code. But first you must remember to include Microsoft.SqlServer.Management.Smo Dim serverName As String = cbSqlServers.Text.ToString Dim l_objRestore As Restore = New Restore() Dim serverConnection As New Microsoft.SqlServer.Management.Common.ServerConnection serverConnection.ServerInstance = serverName serverConnection.LoginSecure = False serverConnection.Login = txtUserName.Text.Trim.ToString […]
Posted on November 23rd, 2015 by Rashmita Devi
While using DevExpress GridView if you need to show a context menu when the user right clicks on the GridView then you have to handle theShowGridMenu event of the GridView. For example, let’s say I have a GridView as grdvCustomer and I want to show two buttons while the user right clicks on a […]
Posted on November 23rd, 2015 by Monalisa Brahma
Rad:Calendar has an option to show multiple months at a time and the FocusedDate property is used to set a month as starting month. This is also useful when you want to retrieve a stored Date from a database table and highlight it in the calendar. The Date obtained from the DB can be set as the […]
Posted on November 23rd, 2015 by Naveen Saini
We can display the Mutipage Tiff Images over web page in many ways. But the easiest and the straight forward way to do this is to convert them into the PDF & then show the same in Adobe Reader. Prerequisite\Assumption: – Adobe reader needed to be installed to display TIFF as PDF. – Tiff2PDF (i.e. […]
Posted on November 23rd, 2015 by Tejaswini Das
There may be scenarios where we require to know which control has triggered the postback event both at client-side and server-side. For all the controls except button and Imagebutton Below are two hidden fields added by Asp.net. <input type=”hidden” name=”__EVENTTARGET” id=”__EVENTTARGET” value=”” /> <input type=”hidden” name=”__EVENTARGUMENT” id=”__EVENTARGUMENT” value=”” /> “__EVENTTARGET” value is set to the […]
Posted on November 23rd, 2015 by Rasmita Mohanty
Avoid Duplicate record insert on page refresh using ASP.NET One of most common issue which many of the web developers face in their web applications, is that the duplicate records are inserted to the Database on page refresh. If the web page contains some text box and a button to submit the textbox data to […]
Posted on November 23rd, 2015 by Shantilaxmi Patro
It generally happens with many developers that they want some value from the datasource to be carried in Asp.net Data controls (ListView, GridView etc) but don’t want to show that value in the UI. One traditional way to do this is to bind that value to a column or hidden field and set the control visibility as false. To get rid of that we […]
Posted on November 23rd, 2015 by Naibedya Kar
Sometimes we may need to get the HTML contents of a web page programmatically and without loading it in a browser. The following code can be used for doing it. Let’s take a look.. Private Function ReturnWebData(ByVal URL As String) As String Dim WebResltStr As String = Nothing Dim DtStrm As Stream = Nothing Dim StrmRdr As StreamReader = […]
Posted on November 23rd, 2015 by Anita Bhanja
Many times developers get confused with the use of Response.Redirect and Server.Transfer . Server.Transfer(“~/Webpage2.aspx”) Server.Transfer does the same thing as that of Response.Redirect , but it saves server resources by avoiding a round trip to the client. When we use Response.redirect, it tells browser for the new page and browser sends another request for […]
Posted on November 23rd, 2015 by Surama Hotta
By default RadGrid has a Property to add New Records. It’s style depends upon the inbuilt Skin you apply in your RadGrid. Sometimes you may want to diaplay Custom image instad of the default one. Following code helps you to add Custom image. Here i added a Custom image for “Add New Records” in RadGrid. […]
Posted on November 23rd, 2015 by Anita Bhanja
When we create ASP controls at runtime, the fresh instances created are available in the current scope only. In the next page postback they are lost.That means we loose the controls and they are no longer existing in the page now. Now if we try to find the control’s ID then we get error. There are many […]
Posted on November 23rd, 2015 by Aditya Acharya
Accessing master page’s control in content page’s through Javascript might initially seem easy but as you work with it you realize that this may not be very true. While we are writing document.getElementById(‘<%= controlName.ClientID %>‘) it can access only those control which are present in the page. So we cannot give master page control name […]
Posted on November 23rd, 2015 by Sumit Singh
In the Page Directive of the Asp.Net Page, add the property ‘MaintainScrollPositionOnPostback’ and set its value as ‘true’. Example: <%@ Page Language=”C#” CodeFile=”Default.aspx.cs” MaintainScrollPositionOnPostback = “true” Inherits=”_Default” %> Now, the page will maintain the scroll bar position in the same location as it is before postback.
Posted on November 23rd, 2015 by Sathyan R
Background: It is very common for people to use <asp:SqlDataSource> to bind controls in ASP.NET web pages. There are many developers who use <asp:SqlDataSource>to bind controls in their aspx pages. It is also prevalent to bind <asp:DropDownList> also using this <asp:SqlDataSource> But is it OK to use this for every single control (let us say […]
Posted on November 23rd, 2015 by Rasmita Mohanty
In ASP.NET we can restrict carriage return in Textbox control by using the following sample code in design level of the application, which is using ASCII value for the enter key. Its check each character’s ASCII value entered into the textbox, so when the enter key is pressed its also check the ASCII value and […]
Posted on November 23rd, 2015 by Devi Das
UpdatePanel is used in ASP.NET for doing partial postback. Suppose you are having a page and you want some portion of that page to be refreshed or changed, so in that case why refresh the whole page. In this scenario we may use UpdatePanel and the control inside that updatepanel will get refreshed or changed not the […]
Posted on November 23rd, 2015 by Chinmayi Samal
A Tip While Using ViewState View state maintains data in a page across postbacks. And this data passes in form of hidden field data. There is a certain limitation of this hidden field. If your hidden field will be greater than that specified value, then sometimes firewalls and proxy servers refuse to let your data […]
Posted on November 23rd, 2015 by Bibhuti Chanda
Sometimes you need to scan messages comming to your mail to check if it contains some viruses or malicious programs. Also in situations like while downloading content you need to scan the content before you download. Here is the sample code to invoke Avast antivirus(not checked for others) to scan the content of a folder. using System.Diagnostics; […]
Posted on November 23rd, 2015 by Anita Bhanja
f you have Master page for your website then you must be needing reference to its controls from the child content page. There are various ways to do it. To get strong access between master and content page you can add @ MasterType directive to your content page. For example if your Page directive has masterPageFile […]
Posted on November 23rd, 2015 by Aditya Acharya
What — To create a variable with table-like structure and to store the information within it. And to retains the records with page postbacks. Why — The need of temporary table may be necessary if you don’t want to interact with the database as and when you need it. Rather you prefer storing all information in some intermediate variable […]
Posted on November 23rd, 2015 by Sumit Singh
In single line Textbox, Ajax Control Toolkit – AutocompleteExtender works fine. Once we use AutocompleteExtender in a Multiline Textbox and think of using new line as delimiter character, then it used to give some issue. (In MultilineTextbox, suggestions to come ‘one time – in each line’ is a frequently required need.) The problems are like – some time suggestions do […]
Posted on November 23rd, 2015 by Sumit Dhal
The Session state in any web technology depend on cookie at the client end to store and resend session id back and forth between client browser and web server. But Asp.net also supports cookieless sessions with the following attribute addition in the web.config within system.web node. With the above config setting, it carry the session id […]
Posted on November 23rd, 2015 by Manaswinee Mohapatra
In a DevExpress GridView to get the customized Summary of a Column we have to handle CustomSummaryCalculate event of the GridView. And we have to set theSummaryType property of that column to “Custom”. Below is an example of a GridView showing student details, in which we want to show the Customized Summary value of the […]
Posted on November 23rd, 2015 by Chinmayi Samal
At times we may want to automatically change images in a given time interval so that our web page will looks good. We can do it by taking Timer control and UpdatePanel. In the below example 9 images are taken and image of a banner is changing with these images periodically.A timer control is taken and it’s […]
Posted on November 23rd, 2015 by Sumit Singh
In AutoCompleteExtender in almost every key press in the textbox, the Ajax call goes to the associated web service. Few service calls are stopped by caching if it is enabled. But in most cases it fires. So, if you enter 20 character, then 20 times call goes to the service and subsequently, 20 times […]
Posted on November 23rd, 2015 by Devi Das
When a user is loading a web page, for every object on the page (e.g: images, stylesheets, scripts) there is a corresponding HTTP request made to the server. These HTTP requests will delay the response time if the web page contains large number of objects. To reduce the delay, we have to get rid of […]
Posted on November 23rd, 2015 by Anita Bhanja
You must have noticed in the properties window of ASP.NET controls, there is a property called (Expression) in the Data section. This is used to set the property of controls based on the information that is evaluated at run time. If you open expression dialog box, then you can see Bindable properties in left hand […]
Posted on November 23rd, 2015 by Aditya Acharya
What If you are using jQuery in your application then you may be familiar withdocument.ready() function of jQuery. This function executes after all the elements are loaded in the page. So it is a better way to bind the events for elements or to write some initialization Javascript which we want to be called on […]
Posted on November 23rd, 2015 by Santosh Bisoyi
You always come accross a confirmation message “Are you sure you want to delete this item ? ” while deleting an item. In web application basically we attach a javascript function with the OnClientClick event of the server control to ask user confirmation before delete the item. So this is not a big problem if […]
Posted on November 23rd, 2015 by Amit Mohapatra
The information about the page are generally store using HTML <META>tags in the <HEAD> section of the page. These tags are also useful for providing information about the page. Thay also help the page to be more search engine friendly. During the designing phase we can add these tags to the page. But they […]
Posted on November 23rd, 2015 by Shibani Shubhadarshini
Following tip is used to populate DateEdit control in a similar way in both Vista, XP machine. Without setting any property for VistaDisplayMode, if one uses DevExpress.xtraEditors.DateEdit control in an windows application and runs it in a Vista machine then the DataEdit control dropdown opens with a clock based calender which s not shown in […]
Posted on November 23rd, 2015 by Sumit Singh
ASP.net Ajax Control Toolkit Color Picker Extender have a SampleControlID property, that shows the selected color’s hexadecimal color code value for further use. But some time for better ui visibility need, if you don’t want that hexadecimal color code to appear in the same control, then here is the way to do that. In this sample code below: I used a […]
Posted on November 23rd, 2015 by Mritunjay Kumar
Sometimes we may need to generate the thumbnail size of image dynamically. Suppose one situation: We have a list view, which shows the uploaded documents, but you need to show the thumbnail size of the images for the image files. But there is one condition: The original image file should not get loaded, because that […]
Posted on November 23rd, 2015 by Devi Das
Suppose you are using Range validator for a textbox for validating a range between 1 to 100 and you have written the code like: Previous code : <asp:TextBox ID=”txtControl” runat=”server” MaxLength=”3″ Width=”30″ /> <asp:RangeValidator ID=”rv_txtControl” runat=”server” ControlToValidate=”txtControl” MinimumValue=”1″ MaximumValue=”100″ Text=”*” Display=”Dynamic” ErrorMessage=”Range Exceeds”> </asp:RangeValidator> <asp:Button ID=”btnValidate” runat=”server” Text=”Validate” /> Now if I provide values like […]
Posted on November 23rd, 2015 by Sachin Kumar
Collapsible panel is one of the exotic controls present in Ajax Control Toolkit of ASP.NET. Apart from several built in functionalities, there are situations when the user needs to close (collapse) or open (expand) the collapsible panel through script. Further, there are “ExpandControlId” and “CollapseControlId” attributes present in the collapsible panel to control the collapse and expand on […]
Posted on November 23rd, 2015 by Amit Mohapatra
In Visual Studion 2008 while working with code we use the “Go To Definition” or “F12” to go to the definition of a function from the function call, we can able to go to the CssClass from the aspx page by using “Go To Definition” or “F12”. It does not matter whether the CssClass is […]
Posted on November 23rd, 2015 by Aditya Acharya
If we are using ASP.NET Radiobuttonlist in our page it becomes a little difficult to find the instance of it through Javascript because it is rendered in a different way in the browser ( the code is reproduced below ) ASP.net Code —————– <asp:RadioButtonList ID=”RadioButtonList1″ runat=”server” RepeatLayout=”Table”> <asp:ListItem Text=”AAA”></asp:ListItem> <asp:ListItem Text=”BBB”></asp:ListItem> </asp:RadioButtonList> Is rendered in […]
Posted on November 23rd, 2015 by Bibhuti Chanda
Ajax Control toolkit provides Ajax Tab Container control to display the content in tabs. If you want to display the content in different tabs you just drag and drop a Ajax Tab Container control to your page and add as many tab panels as you need in the page. Example <cc1:TabContainer ID=”TabContainer1″ runat=”server” CssClass=”ajax__myTab”> <cc1:TabPanel […]
Posted on November 23rd, 2015 by Devi Das
Suppose in your application you are using a DropDownList in a Form and depending upon the item selection you are showing/hiding some views inside a Multiview and you want that the user must select one of the item from the DropDownList before submitting a Form. So you can write code like the following to validate […]
Posted on November 23rd, 2015 by Rabinarayan Biswal
Some useful information on ViewState : 1. In asp.net ViewState is used to keep state information of controls to cope with the state less nature of HTTP and provides a means to persist the state across postbacks. 2. There is a saying – There is no free lunch . And ViewState is no exception . […]
Posted on November 23rd, 2015 by Devi Das
In your projects you must have used ASP.NET validation controls like Required Field Validator, Range Validator, Custom validator, etc. Suppose in a page you have used Required Field Validator for a textbox, so while Form submission it will validate the textbox control for its value. But if you want to disable validation for a particular […]
Posted on November 23rd, 2015 by Amit Mohapatra
Request.IsLocal: – It is a property of the Request object by which we can identify whether the application is running on a locall development server or in a production server. HttpContext.Current.IsDebuggingEnabled: – It is a property of the HttpContext object which can identify whether the debug property of the <compilation> element of the webconfig file […]
Posted on November 23rd, 2015 by Rasmita Mohanty
Most of the times we need to refer to the folder path containing the project in Visual Studio platform, for that we need to go to Windows Explorer and then search for the folder name containing the project you are currently working on, then select the folder for further actions.Now by using this tip we […]
Posted on November 23rd, 2015 by Mritunjay Kumar
How to get distinct rows from a list using LINQ: Think about a situation when records in list are something like below: Employee1: EmployeeId=1, Name=”Name1″, EmployeeType=2; Employee2: EmployeeId=2, Name=”Name2″, EmployeeType=3; Employee3: EmployeeId=3, Name=”Name3″, EmployeeType=1; Employee4: EmployeeId=4, Name=”Name4″, EmployeeType=2; Employee5: EmployeeId=5, Name=”Name5″, EmployeeType=3; And we want the records of Employee1, Employee2, Employee3 (which are actually distinct […]
Posted on November 23rd, 2015 by Biswajit Satapathy
When trying to upload images through FCK Editor tool inside an aspx page it throws an error[XML 403 path Error]. To Fix the issue we have to configure manually. STEP-I : File Path : fckeditor/fckconfig.js Previously : var _FileBrowserLanguage = ‘asp’ ; // asp | aspx | cfm | lasso | perl | php | […]
Posted on November 23rd, 2015 by Devi Das
Use int.TryParse() to keep away from Exception. While using Convert.ToInt32(), if the input parameter is of wrong format and if it can not be convertable into integer then an exception of type “System.FormatException” will be thrown, but in case of int.TryParse() no Exception will be thrown. e.g :- If we are converting a QueryString value […]
Posted on November 23rd, 2015 by Aditya Acharya
ASP.NET pager doesn’t provide any direct support for adding tooltip to its different buttons . But there are some work arounds through which you can provide tooltips to ASP.NET data pager. The structure of a simple data pager is as follows: <asp:DataPager ID=”dpPager” runat=”server” PagedControlID=”lvCourses” PageSize=”5″ OnPreRender=”dpPager_PreRender”> <Fields> <asp:NextPreviousPagerField ButtonCssClass=”command ” FirstPageText=”«” PreviousPageText=”‹” RenderDisabledButtonsAsLabels=”true” ShowFirstPageButton=”true” […]
Posted on November 23rd, 2015 by Santosh Bisoyi
Definition : Screen scraping is a technique in which a computer program extracts data from the HTML output of another program. Further details : Screen scraping is a lot easier in ASP.NET. The only thing you have to do is to how to retrieve HTML from webpages dynamically.But Using the .NET library it is easy […]
Posted on November 23rd, 2015 by Anita Bhanja
Warning the user before leaving the page !!! Difficulty Level : Intermediate You might have seen in many of the web form pages to warn the user before closing the page.When somebody refreshes the page, then there is a chance for loosing all filled data. In that case it is very helpful. Page life cycle […]
Posted on November 23rd, 2015 by Rasmita Mohanty
To open a new browser window we can use the Process Class and a Start Method.The Process class contains a static Start method. Because we can call Start without having an instance of a Process class. By using Process Class we can also open an URL path, a file path, or a FTP address programmatically […]
Posted on November 23rd, 2015 by Amit Mohapatra
Although GridView is a very powerful control provided by ASP.NET, it has a major flaw : Whenever we are populating the GridView from database, then, if there is some data to be shown in the grid then it displays fine(along with Header and Footer) but if there is no data then nothing is shown in […]
Posted on November 23rd, 2015 by Amit Mohapatra
During the development of a page you may need to populate a number of controls from DB. In that case you have to write a number of functions to populate different controls. In this tip I am going to show you a way to do all these operations in a single function. Step 1: – […]
Posted on November 23rd, 2015 by Sachin Kumar
Problem ComboBox is one of the exotic controls present in AjaxControlToolkit . But I have come across some problems while using it. They are : After clearing all the items of Combo Box , the selected item does not get cleared , even after post back. Sometimes after binding the data , Combo box is […]
Posted on November 23rd, 2015 by Shantilaxmi Patro
Applying rounded corner to modal popup panel may look nice on the UI but it also causes issues such as the content of he panel is lost even if we can see a modal popup panel with rounded corners. The workaround to solve this issue is described in following steps : – Take two panel, […]
Posted on November 23rd, 2015 by Priyanka Dash
Bread Crumbs is a new Site Navigation feature in ASP.NET 2.0, which can make building navigation structures across a web site much easier and simpler. It’s very easy to create Bread Crumbs with ASP.Net 2.0. Breadcrumbs are links that shows the user his/her current position in the website. This is the path from the root […]
Posted on November 23rd, 2015 by Amit Mohapatra
GridView is a very powerful and highly customizable control provided by ASP.NET. The process of adding a GridView control dynamically to a page is almost same as of the other controls. But the problem comes when you want to add a TemplateField dynamically to a dynamically created GridView control. This is so because the TemplateField […]
Posted on November 23rd, 2015 by Devi Das
AJAX Control toolkit provides sophisticated RATING control using which you can have rating facility in your website. Its very simple to use but there is a problem you could come across while creating it dynamically. The problem is in the ViewState, which means you can’t get the selected rating value of dynamic Rating control (from […]
Posted on November 23rd, 2015 by Sachin Kumar
Problem If we are using watermark extender in a textbox, and also are trying to set the value of TextBox using JavaScript or jQuery, the text takes the format of watermarkCssClass style of that watermark extender . e.g: $(‘#textboxId’).val(“My Text”); For instance, if we set the watermark style as italic and color as gray , […]
Posted on November 23rd, 2015 by Aditya Acharya
The ListBox and DropDownList both are very useful for their own advantages. Their differences lie in their User Interfaces, DropDownList take less space but need more clicks to access while ListBox takes more space but provides everything itself on the page. You can easily change the UI of a ListBox to DropdownList and vice versa. […]
Posted on November 23rd, 2015 by Aditya Acharya
In Some cases while displaying a large number it will be nice if we can format the number to a more readable format Like : Reputation Point : 537456 Can be more readable if we can write it as Reputation Point : 537,456 ASP.NET provide features like String.Format(format,arg0) to format arguments into different forms. For […]
Posted on November 23rd, 2015 by Narendra Mallik
Suppose we have five buttons in a form in a web page and we want to generate the click event for a specific button (let the name of the specific button be btnDefault) when the enter key is pressed in the form. It is very easy to run the event handler of btnDefault (specific button) […]
Posted on November 23rd, 2015 by Sumit Singh
Some time we need to make textbox read-only for showing data. If we make textbox read-only at the designer setting as below, then the textbox always returns blank in the code behind. <asp:TextBox ID=”txtDate” runat=”server” ReadOnly=”true”> Here I am giving you an example of the issue and the solution. For date picker I used ASP.NET […]
Posted on November 23rd, 2015 by Amit Mohapatra
I came across a very interesting error while using buttons/link buttons in the GridView for editing the GridView rows data. The exact situation I faced is like this – I have a GridView with a column which contains an edit button. The button is associated with the CommandName property as “Edit”. The GridView is associated […]
Posted on November 23rd, 2015 by Aditya Acharya
MSDN Says : Predicate<T> delegate Represents the method that defines a set of criteria and determines whether the specified object meets those criteria. We can use this functionality when filtering any collection object which satisfy certain condition. Here is an example how to use it in our application. In this example we will see different […]
Posted on November 23rd, 2015 by Santosh Bisoyi
Since .NET Framework[2.0 or 3.5] does not provide the “Clear” Method for StringBuilder class, sometimes as a developer you may come accross a sitution like using the StringBuilder object for concatenation operation of some sets of random number of string and then empty it and again re-use it for another concatenation operation. So there are […]
Posted on November 23rd, 2015 by Manoranjan Mohapatra
THE PROBLEM We all know that when a user navigates through a website, each page s/he visits is logged by the browser in their history. An inherent problem with an Ajaxified application is browser navigation, as AJAX pages don’t postback while making request,they cant remember their previous states. The problem that arises here is that […]
Posted on November 23rd, 2015 by Sachin Kumar
Problem : Let us think of a scenario : Suppose we have a search page (A.aspx) which contains a tabular view of student data . The page contains a filter button to filter the students based on some condition . Initially the table contains all students data (say 100 records) . Now after pressing the […]
Posted on November 23rd, 2015 by Devi Das
In ASP.NET if we want to show autocomplete suggestion in a textbox (e.g: In Google when we start typing something it shows us a list of suggestion depending on the words / letters we have typed), then we can use AjaxControl Toolkit’s AutoComplete Extender. Generally AutoComplete Extender does an Ajax call to ASP.NET Webmethod and […]
Posted on November 23rd, 2015 by Devi Das
For almost all HTML controls there are its corresponding ASP.NET controls. For HTML ‘Div’ there is its ASP.NET counterpart ‘Panel’, for HTML ‘Span’ there is ASP.NET ‘Label’. Likewise for HTML ‘Ul’ (Unordered list) there is Bulleted List. Both HTML Unordered list control and ASP.NET Bulleted list control have their own advantages and disadvantages, like – […]
Posted on November 23rd, 2015 by Aditya Acharya
Content: As we all know ASP.NET provide some validation extenders which can be implemented on controls to validate them at Client & Server side. Some of those validations extenders are : . Required Field Validator (Validate the control for not filling up any information). . Range Validator (Validate the cotrol with respect to lower & […]
Posted on November 23rd, 2015 by Aditya Acharya
At times we need to pass some values across pages in our application. Now, as commonly known, HTTP is based upon stateless protocol, it can’t remember status of the past requests. So we have to explicitly manage state of the page. There are various Client side state management as well as server side state management […]
Posted on November 23rd, 2015 by Devi Das
In ASP.NET you might have used AJAXControl Toolkit’s AutoComplete extender. It is used to created auto suggested textbox. Like google search’s textbox (on entering some value suggestion will be shown to the user). In my application i have also used AutoComplete extender to get suggestion for user name. But in my case i wanted […]
Posted on November 23rd, 2015 by Aditya Acharya
In ASP.NET HiddenField is an useful control which can be used to pass some values to client side during page postbacks. It has no user interface so it is only used to store hidden values. These hidden values can be used for Ajax call and other similar kind of functions. As hiddenfield value can be […]
Posted on November 23rd, 2015 by Devi Das
If you want to know what is reCAPTCHA and how to use it in your ASP.NET Web application then please refer to the Tip “How to use reCAPTCHA in your site?” In the above Tip i am validating the captcha on postback. But this tip will show you how to validate the captcha by AJAX […]
Posted on November 23rd, 2015 by Devi Das
For showing data in a list format we may use Gridview or Listview or Repeater. But suppose no data is there for a particular filter or in a particular instance then we should show some custom message to the user saying that no data is there to show or some similar messages. If we are […]
Posted on November 23rd, 2015 by Smruti Sahoo
Recently, I faced an unusual problem while working with JPEG images in a project. What I found is that some of the images with .jpg extension were not being displayed in Internet Explorer, instead a red mark displayed where the image should have been. Further research revealed that Internet Explorer was unable to display images […]
Posted on November 23rd, 2015 by Smruti Sahoo
Kentico CMS provides various built-in web parts. We can also have our custom web parts and use them within our pages as this flexibility is provided by Kentico CMS system. Below steps are to be followed to create and use a new custom web parts using Kentico CMS. 1) Open the WebProject solution created at […]
Posted on November 23rd, 2015 by Palash Mondal
Problem For past few days I have been facing a problem while dynamically making a list item selected. Here is the code that I have used. Code ASPX <asp:DropDownList ID=”DropDownList1″ runat=”server” Width=”150px”> <asp:ListItem Value=”0″ Text=”– Select –” Selected=”True”/> <asp:ListItem Value=”1″ Text=”Red” /> <asp:ListItem Value=”2″ Text=”Greeen” /> <asp:ListItem Value=”3″ Text=”Yellow” /> <asp:ListItem Value=”4″ Text=”Pink” /> <asp:ListItem […]
Posted on November 23rd, 2015 by Sachin Kumar
If you are already familiar with the basics of HttpWebRequest and HttpWebResponse classes for WebCommunication, the following code can help you get the response using HttpWebRequest . HttpWebRequest hRequest = (HttpWebRequest)WebRequest.Create(“yoururl@url.url”); This is the basic way to get HttpWebRequest . It is fastest way but difficult to implement for downloading of content to our local […]
Posted on November 23rd, 2015 by Aditya Acharya
Web.config plays an important role when we create web application in ASP.NET. Normally here we store some custom application level settings (like Database Connection String, Mail Server address, etc…). Some of the advantages of keeping values in web.config file are. 1. Easily Readable (As it is in XML file format). 2. Accessible through out our […]
Posted on November 23rd, 2015 by Devi Das
If the response time of your website is high, i.e if it is taking more time to display the content then the user might lose the interest in using the website. So it is important the response should be as fast as possible. Compression is one of the methods in which we can reduce the […]
Posted on November 23rd, 2015 by Vikash Kumar
What is Profile? The ASP.NET profile feature associates information with an individual user and stores the information in a persistent format. Profiles allow you to manage user information without requiring you to create and maintain your own database. In addition, the ASP.NET profile feature makes the user information available using a strongly typed API that […]
Posted on November 23rd, 2015 by Aditya Acharya
Using AJAX and web services in your application can make it richer. But passing information from the client end through Ajax is always a headache as the information can be hacked. That means the end user can change the post parameter values and can explore information that you want to hide from them (Only if […]
Posted on November 23rd, 2015 by Devi Das
ASP.NET provides ScriptManager using which we can combine our script files. There is already a tip which describes “How to merge your Javascript files in ASP.NET”. But ScriptManager in ASP.NET does not provide us the facility to merge CSS files. We can achieve it by the following steps: Step 1: Create an HTTP handler which […]
Posted on November 23rd, 2015 by Palash Mondal
Infragistics WebHierarchicalDataGrid In WebHierarchicalDataGrid, we sometimes need to expand the active row’s child band in javascript. This can be done using the following js function : Js file – function ExpandActiveRowChild() { var grid = ig_controls[“<%= whdg1.ClientID %>”]; var parentGrid = grid.get_gridView(); var rows = parentGrid.get_rows(); // gets a reference to the container grid’s rows […]
Posted on November 23rd, 2015 by Shashi Ranjan
Very Often we come across the need to capitalize the first letters of some word or some text. For example : when we want to display users name or city name etc. Recently I came across the same problem . Since string class does not have a method to do this we could think that […]
Posted on November 23rd, 2015 by Vijay Goyal
SessionStorage is an alternative to session cookies, but more powerful. The data recorded in the storage are available in all web pages from the same site and to the same user during the session. However, the real advantage is that when using Session Storage it is possible to carry out multiple transactions in different windows […]
Posted on November 23rd, 2015 by Shashi Ranjan
Suppose we have a condition that we don’t want to allow the access of our website in certain parts of the world . That we can do here in ASP.Net . In the process , it retrieves the country based on the browser . It isn’t going to be 100% accurate but probably more like […]
Posted on November 23rd, 2015 by Chandan Kumar
Razor is a view engine of ASP.NET MVC .It’s primary objective is to implement a syntax which is compact ,easy and more fluid. It’s vey helpful in maintaining the flow of code and markup together with very less hinderance from the control character which programmar has to enter every time he shifts betwenn code and […]
Posted on November 23rd, 2015 by Palash Mondal
PROBLEM Few days back, my client asked me to add hyperlinks to asp CheckBoxList list-item , so that the user can open a pdf / doc file on click of it and after reading it check the check-boxes based on their requirement. But the thing was that, the CheckBoxList is bind from code-behind, so we […]
Posted on November 23rd, 2015 by Palash Mondal
PROBLEM Due to clients requirements, most of the time I had to work on Third Party Controls like Infragistics. But the problem I faced while working with these controls is that the source code / samples for these controls is minimal or not correct or we have to search multiple forums before getting the solution. […]
Posted on November 23rd, 2015 by BIBHUDUTTA PRADHAN
Yesterday while I was going through the web config, I came across a section which tempted me to explore it further . The section is ” <tagMapping> ” inside <pages>, inside <system.web>. Now allow me share, what I learnt. I think its little known and rarely used feature of ASP.NET. Rarely used because there’s only […]
Posted on November 23rd, 2015 by Shashi Ranjan
Recently I came across a situation where I was using aspx page to return Json Data to bind a flex . It was going well (mostly all the times ) except a situation (Probality with 1 out of 10 ) where I was getting redundent JSON data from aspx page . Then I got a […]
Posted on November 23rd, 2015 by Palash Mondal
PROBLEM Binding a CheckBoxList is bit easy but binding a CheckBoxList within a DataList becomes little difficult and many programmers are faced with issues like checkboxlist within the datalist not displaying. SOLUTION So, here is a simple way to bind CheckBoxList within a DataList :- ASPX <asp:DataList ID=”dlSample” runat=”server” OnItemDataBound=”dlSample_ItemDataBound”> <ItemTemplate> NAME: <asp:Label ID=”lblName” runat=”server” […]
Posted on November 23rd, 2015 by Devi Das
WCF exception messages are very tough to decode. WCF provides default TraceListener objects for core WCF objects (like System.ServiceModel, System.Runtime.Serialization, System.ServiceModel.IdentityModel, etc). These objects can be used to get the tracing information which will help you to find out any exception details easily. To enable tracing we need to add the following piece of code […]
Posted on November 23rd, 2015 by Srinivasa Alapati
Active directory Authentication using forms authentication and login control in ASP.NET: For Active directory authentication in asp.net using login control we have to follow the following steps. Step 1: Create login page with asp.net login control. No need to add code, login control automatically will check from the web config settings. Step 2: Add the […]
Posted on November 23rd, 2015 by Srinivasa Alapati
Some times we may need to allow users to access some pages with out login such as help pages or contact us, home page…etc., with out login in to the application. If we want to allow user to access Help.aspx page before login, we have to add that page details in web.config file as below. […]
Posted on November 23rd, 2015 by Shashi Ranjan
Many time we come across the scenarios when we have to appened the directory /folder names , file names etc . In this process we have to take care of slash “\\” to append the names. Code like this are very prone to error. For example, when you set the folder setting, you have to […]
Posted on November 23rd, 2015 by Srinivasa Alapati
Some times we need to do some action on the grid row click or have to do some action on grid row double click or we may need both some action on row single click and some action on row double click. For implementing this we need to add two columns to the grid which […]
Posted on November 23rd, 2015 by Ashish Kumar
While working on Web applications in many situtions i saw that usually developer use Alternative text on images(or imagebutton) to serve both the purpose i.e. first to show the text when image is not there (may be image type is not supported or may be something else) and second to show the text on the […]
Posted on November 23rd, 2015 by Ashish Kumar
While working with CrystalReport we usually meet situations in which the report will take more then usual time in loading.Here i am talking about crystal report but it may be the situation of any heavy page. In these situation due to lack of information user may try to click or may be close the browser […]
Posted on November 23rd, 2015 by Srinivasa Alapati
We may need to send multiple records to database from code behind, at that situation we will make multiple requests to db. If the number of records increased than it may take performance penalty. If we send all the records at once to database then performance will be increased. One of the method to send […]
Posted on November 23rd, 2015 by Sudhansu Prusty
Many times we need to export our data in xml format, but writing the xml data to a predefined xml file already included can cause concurrency problem for multiple users accessing the same file, also it is not a good idea to generate xml file with multiple names in the server as it will overload […]
Posted on November 23rd, 2015 by Prachi Mishra
Posting/adding data into facebook Facebook is the most widely used Social Networking site. Thus it will be greatly beneficial for facebook users if they can directly access data outside facebook in their own web sites. This data includes a user’s friend list, live feeds, wall posts and many more. Here I have explained how to […]
Posted on November 23rd, 2015 by Tapan Kumar
If you are trying to change the image source whenever somebody click on it then here is the best way to achieve this. Just two line of code and your headache is gone. First of all I am taking a HTML image tag and specify a class name for that image tag. In JQuery find […]
Posted on November 23rd, 2015 by Vikash Kumar
Accessing and saving custom settings from web.config in ASP.NET We usually save our application settings through key and value in appSettings element of web.config file. But accessing the attributes in coding is cumbersome. The string value is needed to enter everytime and then typecasting is need to be done. Example: web.config setting <appSettings> <add key=”twitterUserName” […]
Posted on November 23rd, 2015 by Devi Das
Monitor how much time the server is taking to process a request and to give a response. Sometimes we need to monitor the performance of our web application, like how much time the server is taking to process a page. To find out the time a particular request is taking to get processed we can […]
Posted on November 23rd, 2015 by Amit Mohapatra
Each web control has a lot of properties for customization. These properties can be set by the developer during design time or runtime with different predefined values. Such a property is BorderStyle, which is used to set the border of the web controls. This property has a lot values like Solid, dotted etc etc.. Along […]
Posted on November 23rd, 2015 by Amit Mohapatra
How to restrict the Calendar selection within a specific range: Some time we may be in a situation when we need that the user must select a date which is within a specific range(January 2005 – January 2015) from the calendar control of the ASP.NET. But unfortunately the calendar control does not have any specific […]
Posted on November 23rd, 2015 by Madhusmita Rout
Before going to access the controls on a crosspagepostback, we should know what is crsospagepostback.. Actually it is a concept where one page postbacks information to another page instead of itself. Any server control implements System.Web.UI.WebControls.IButtonControl interface can cause a crosspage postback i.e -Button/Image Button etc, by setting the PostBackUrl property. Generally to access the […]
Posted on November 23rd, 2015 by Mahesh Korupolu
When you are working with ASP.NET Web Application, after you make any changes to codebehind file for these changes to be effected we need to recompile the codebehind file.During development stage this will sometimes pain you because you need to recompile the code every time you make any changes to the code. There is a […]