Sunday, 18 October 2015

Uploading files larger than 5 mb in ASP.NET


  • One of the small stuff that some of the freshers are messing with is uploading the file of size larger than 5 MB or more.
  • It is really so easy to resolve, the thing you need to do is just add a <httpruntime/> tag to your web config file under <system.web> as shown and that's it done.

  • You may change the size 16384 (16 MB) to what ever you want e.g 4096, 8192 or 65536 (64 MB).
  • Enjoy the coding.

Friday, 2 October 2015

Access the .NET Server Controls using javascript easily


  • There are many developers that are depend on intellisense provided by Microsoft Visual Studio.
  • But some times it may not work for scripting, though in VS 2012 and higher version it quite run much good.
  • So here are some of the JS code that I would like to share with developers for accessing the .NET controls and how to retrieve and set value to controls.
  • Get Label Value:
  • $('#<%=Label.ClientID%>').text();
  •  Set label value:
  • $('#<%=Label.ClientID%>').text("New Value");
  •  
  • Get Textbox value:
  • $('#<%=TextBox.ClientID%>').val();
  •   Set Textbox value:
  • $('#<%=TextBox.ClientID%>').val("New Value");
  •  Get Dropdown value:
  • $('#<%=DropDownList.ClientID%>').val();
  •  Set Dropdown value:
  • $('#<%=DropDownList.ClientID%>').val("New Value");
  •  Get text of selected item in dropdown:
  • $('#<%=DropDownList.ClientID%> option:selected').text();
  •  Get Checkbox Status:
  • $('#<%=CheckBox.ClientID%>').attr('checked');
  •  Check the Checkbox:
  • $('#<%=CheckBox.ClientID%>').attr('checked',true);
  •  Uncheck the Checkbox:
  • $('#<%=CheckBox.ClientID%>').attr('checked',false);
  • Get Radiobutton Status:
  • $('#<%=RadioButton.ClientID%>').attr('checked');
  •  Check the RadioButton:
  • $('#<%=RadioButton.ClientID%>').attr('checked',true);
  •  Uncheck the RadioButton:
  • $('#<%=RadioButton.ClientID%>').attr('checked',false);
  •  Disable any control:
  • $('#<%=TextBox.ClientID%>').attr('disabled', true);
  •  Enable any control:
  • $('#<%=TextBox.ClientID%>').attr('disabled', false);
  •  Make textbox read only:
  • $('#<%=TextBox.ClientID%>').attr('readonly', 'readonly');

  • For getting the data you may also use as what I have said in previous blog, that is simpler

How To Pass An Array As A Parameter While Calling an ASP.NET Web API C#

Please visit my C# Corner Blog for this, where I have provided better efforts to make this concept more understandable - www.c-sharpcorner....