Thursday, November 7, 2013

How to import Data from Excel files to Dataset in .Net

Hi,

I want to share a path to import Excel files in .Net.

It is easy to export data to excel from our Grids in .Net(at least we know it very well) but importing data from Excel,it is troublesome task for us.

Naturally we do read through OLEDB, but is slow and troublesome.
To get rid off all these difficulties, we can access(/download) a Codeplex dll,it will read all the data(huge data also) within no time from  excel files into Dataset.

I am just mentioning link below

https://exceldatareader.codeplex.com/


go there and download that package and follow simple instructions(/simple code) to access the excel data,

that will works.

kudos to codeplex and people of Excel Data Reader


Thanks,
Hari



Tuesday, November 5, 2013

How to include FileUpload Control into Update Panel in Asp.Net

Hi,

We all encounter this problem in our applications. we might get into a situation like whole content of page should be in update panels and a FileUpload control is required in that page.

Here,we should sacrifice a update panel to work with FileUpload control.

To get rid off this mess, we can follow below solution.

Observe below code:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:FileUpload ID="FileUpload1" runat="server" />
         <asp:Button ID="btnUpload" runat="server" Text="Upload"
           OnClick = "btnUpload_Click" />               
    </ContentTemplate>
    <Triggers>
           <asp:PostBackTrigger ControlID = "btnUpload" />
    </Triggers>
</asp:UpdatePanel>

Here, FileUpload control and upload button are in a update panel

Everything is same except a Trigger.

This Trigger(PostBackTrigger) makes difference for us.Even though Fileupload control is in update panel,on clicking upload button post back occurs(so that our fileupload will work and rest of the controls will be in update panel as we desired.)

Thanks and Regards,
Hari