Script(s)

what I learn is what u c

Archive for the ‘Web Coding’ Category

Planning to Host WordPress Blog

leave a comment »

Read this article..
http://www.gchandra.com/scripts/?p=172

Advertisements

Written by gchandra

December 5, 2008 at 12:04 am

Posted in Web Coding

Tagged with ,

Handling multiple configuration settings (Development, Staging, Production) gracefully.

leave a comment »

In Asp.net 2.0 multiple connectionStrings & appSettings can be handled very easily using the attribute “configSource”

create a new xml file devAppSettings.config under a new folder myConfigsettings

(continue reading…)

Written by gchandra

May 1, 2008 at 8:52 pm

Posted in Asp.Net, Web Coding

Tagged with

How to Preserve Fileupload value in Asp.net ?

leave a comment »

If you form has Fileupload control along with other controls like dropdownlist, calendar.. you will be facing standard problem of Fileupload control losing value when other controls are selected.

Click here to read the article in full…

 

Written by gchandra

May 1, 2008 at 7:35 pm

Moved to own domain www.gchandra.com/scripts

leave a comment »

I have moved my blog here.. 

 www.gchandra.com/scripts

See you there

Written by gchandra

March 1, 2008 at 1:32 am

Posted in Web Coding

Disable .xml file generation when building Asp.Net application

leave a comment »

Visual Studio 2005 – Compile Options

.XML files are used to create Documentation.

If you need to disable them, then

Project Properties > Compile and Uncheck Generate XML Documentation file option.

Compile Options

Written by gchandra

February 22, 2008 at 9:19 pm

Posted in Web Coding

Tagged with , , , ,

AJAX – Export to Excel / Word

with 17 comments

If you are using Update Panel and try to Export gridview contents to EXCEL or Word, your asp.net page will throw nasty error. “Sys.WebForms.PageRequestManagerParserErrorException”

Its because AJAX & Response.write don’t go together.  By calling Response.Write() directly you are bypassing the normal rendering mechanism of ASP.NET controls. The bits you write are going straight out to the client without further processing (well, mostly…). This means that UpdatePanel can’t encode the data in its special format.

There are couple of ways to solve this problem.

1. Place the Export Button outside of Update Panel.

2. By Pass the Export Button using <Triggers>

 </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID=”cmdExport” />
        </Triggers>

</asp:UpdatePanel>
if your Export button is part of UserControl then specify usercontrolid:buttonid

 </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID=”uscSelCtl:cmdExport” />
        </Triggers>
    </asp:UpdatePanel>

More Reading…

Written by gchandra

January 8, 2008 at 10:12 am

Asp.Net Filter Datatable by Column

with 6 comments

Filter Datatable by Rows

If you need to get subset of a big dataset into datatable Rowwise …


Dim dtEmp as DataTable
Dim dsEmployee as New DataSet

dsEmployee = someobject.getdata()  'dataset can be populated in many ways which is not explained here.

Dim sExpr as String
Dim drRows() as DataRow, drSingleRow as DataRow

sExpr = "EmpID > 100"  'Condition

drRows = dsEmployee.Tables(0).Select(sExpr)

'If you need to add Sort Order it can be added to sExpr

Dim sSortOrder as String
sSortOrder = "EmpName DESC"
drRows = dsEmployee.Tables(0).Select(sExpr,sSortOrder)

For Each drSingleRow in drRows
 dtEmp.ImportRow(drRows)
Next

' Datatable dtEmp has filtered records

Filter Datatable by Column

If you need to get subset of big dataset into datatable columnwise…


Dim dtEmp as DataTable
Dim dsEmployee as New DataSet

dsEmployoee = someobject.getdata()  'dataset can be populated in many ways which is not explained here.

'This copies the structure and data

dtEmp = dsEmployee.Tables(0).Copy

dtEmp.Columns.Remove("Unwanted Column 1")
dtEmp.Columns.Remove("Unwanted Column 2")
dtEmp.Columns.Remove("Unwanted Column 3")

Written by gchandra

January 7, 2008 at 4:13 pm