Tuesday, February 4, 2014

Upload file via input control and empty File Collection in request

when we uplaod files via html input control, sometimes we get Empty file collection on server side, i faced this issue in one of my Sharepoint projects and resolved with adding

Page.Form.Enctype = "multipart/form-data";

in page load.

http://stackoverflow.com/questions/1226612/sharepoint-webpart-upload-file-whitout-using-runat-server

Monday, January 27, 2014

ASP.NET 4.0 ClientModID


We can use control ID in script (insiede html page or js file) without using ClientID clause

like we have
<asp:textbox  id="txtID"  runat="server" text="0"></asp:textbox>
in order to get its value in script we need to write

'<%= txtID.ClientID %>'
 to manipulate its value , but now we can set ClientIDMode property to access controls just like we access html controls in script

<asp:textbox clientidmode="Static" id="txtID"  runat="server" text="0"></asp:textbox>

we can access its value in script

('@txtID').val();



http://weblogs.asp.net/asptest/archive/2009/01/06/asp-net-4-0-clientid-overview.aspx
http://stackoverflow.com/questions/5666011/retrieve-id-of-server-control-using-jquery