This is one of the common requirement we get in our projects.Text box has a wonderful method called " Clear ".This method is used to clear the text in the Text box.I have given a simple example to explain this .I have implemenetd a common method to clear the Text of few Controls .One of that is Textbox. void ClearInputs(ControlCollection ctrls) { foreach (Control ctrl in ctrls) { if (ctrl is TextBox) ((TextBox)ctrl).Text = string .Empty; ClearInputs(ctrl.Controls); } } You can call this method where ever you want to clear the Text from the Textbox. For more information please click this link TextBox Hope this would help the beginners. Cheers.
We normally face a task like to show Menu when we right click the gridview or treeview e.t.c. Many third party controls are providing this right click context Menu to the controls like one of the best third party control like Telerik . But we can do this type of requirements using jQuery also. To do this in ASP.NET we need to download the jQuery Context Menu plugin. We need frame the menu div based on our requirement.See this example to do < div > < ul id ="myMenu" class ="contextMenu" > < li class ="edit" >< a href ="#edit" > Edit Node </ a > </ li > < li class ="delete" >< a href ="#delete" > Delete Node </ a > </ li > </ ul > </ div > * This source code was highlighted with Source Code Highlighter . After downloading the plugin you need to add this l...
We may face a scenario to export the data of custom class object to excel using InterOp .You can get the property name's from the class object using Reflection.Create a work sheet header by reading the each propety of the class object.I have created a separate method to get the all properties into a list collection of string as given below /// /// Get the list of Properties Name into a list collection. /// /// /// public List GetPropeties(Employee objEmployee) { Type myType = objEmployee.GetType(); IList props = new List (myType.GetProperties()); ...
Comments
Post a Comment