There are two ways I’ve found on how to call a resource file from JaveScript and it is largely dependent on where your JavaScript lives. Does it live within a <SCRIPT> tag embedded within your aspx page or does live within a .js file. Embedded within a <SCRIPT> tag within your aspx page: [js light=”true”]… Continue reading Using the resource file from within JavaScript
Category: ASP.NET
How to minify your javascript files
One the easiest ways to minify your js files is to use an online tool like http://javascriptcompressor.com/ Simply paste in your js code into the first text box and select compress and wallah.
CS1061: ‘_____’ does not contain a definition for and no extension method accepting a first argument of type ‘_____’ could be found (are you missing a using directive or an assembly reference?)
I’m using VS2010 and this is the second time I have found myself trying to resolve this error. I had to the project and solution configured targeting platform x86 and targeting framework .Net 3.5. In my most example I was trying the ‘OnServerValidate’ event of an asp:CustomValidator control wired up I received this error message:… Continue reading CS1061: ‘_____’ does not contain a definition for and no extension method accepting a first argument of type ‘_____’ could be found (are you missing a using directive or an assembly reference?)
Using the jQuery DatePicker within an asp.net update panel (on the initial page load the DatePicker doesn’t show–only shows after page refresh)
If the jQuery DatePicker control is not displaying on the initial load but displays after a page refresh try switching from jQuery’s method of determining when the DOM is ready: [javascript light=”true”] $(document).ready( function () { $(‘#TextBox1’).datepicker(); } ); [/javascript] to [javascript light=”true”] function pageLoad() { $(‘#TextBox1’).datepicker(); … Continue reading Using the jQuery DatePicker within an asp.net update panel (on the initial page load the DatePicker doesn’t show–only shows after page refresh)
jQuery DatePicker error “Microsoft JScript runtime error: Object doesn’t support this property or method”
If you are receiving this error “Microsoft JScript runtime error: Object doesn’t support this property or method” while trying to use the jQuery date picker it is because you have not included all the required jQuery file. Steps to rectify Go to the the jQuery download page and select the options you require. http://jqueryui.com/download Download… Continue reading jQuery DatePicker error “Microsoft JScript runtime error: Object doesn’t support this property or method”
Pass Parameters to ASP.NET User Control
This is how you pass a parameter to an ASP.NET user control from the parent .aspx page to the controls .cs page: Create a WebFrom and aWebUserControl within your project. Within your user control create a public property called Text. [xthml] using System; namespace WebApplication1 { public partial class WebUserControl1 : System.Web.UI.UserControl {… Continue reading Pass Parameters to ASP.NET User Control
Bind Dictionary to GridView
If your looking to bind a Dictionary object to a GridView control, like most GridView bindings, here are 3 ways of doing it: Option 1 Declaring the GridView with no coloum specific information: [xhtml] <asp:GridView ID=”SearchResults” runat=”server”> </asp:GridView> [/xhtml] Option 2 Declaring the GridView using the bound column method: [xhtml] <asp:GridView ID=”SearchResults” runat=”server”… Continue reading Bind Dictionary to GridView
Force GridView to display PagerTemplate
When writing custom paging and presenting the data in a GridView, you will need to force the PagerTemplate to display. One method of doing this is by using the GridViews OnPreRender event to force it to happen. [csharp] protected void SearchResults_PreRender(object sender, EventArgs e) { GridViewRow pagerRow = SearchResults.BottomPagerRow; if (pagerRow != null && pagerRow.Visible… Continue reading Force GridView to display PagerTemplate