Saturday, March 30, 2013

how to Add Multiple Value in a Variable In SQL Server


declare @Pipno table(V_3 varchar(500),V_2 varchar(10))

insert into @Pipno (V_3)
Select  COUNT(IMEINo)
 FROM  Jobsheet
WHERE    (ModCode ='H057') AND (ServiceCentreCd ='C009')
 GROUP BY IMEINo,ModCode
HAVING      (COUNT(IMEINo)> 1)
update @Pipno set V_2=1
 Select * from @Pipno

Tuesday, March 19, 2013

How to Export Crystal report in Excel in ASP.Net

private void printreportinExcel(string strReportPath, DataTable dt)
{
//strReportPath  is the report path, dt is the datatable
ReportDocument rptdoc = new ReportDocument();
rptdoc.Load(Server.MapPath(strReportPath));
rptdoc.SetDataSource(dt);

ExportOptions exportOpts1 = rptdoc.ExportOptions;rptdoc.ExportOptions.ExportFormatType =
ExportFormatType.Excel;rptdoc.ExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile;rptdoc.ExportOptions.DestinationOptions =
new DiskFileDestinationOptions();((
DiskFileDestinationOptions)rptdoc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("swapt.xls");rptdoc.Export();
rptdoc.Close();
rptdoc.Dispose();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType =
"vendor/ms-excel";Response.AppendHeader(
"Content-Disposition", "attachment; filename=swapt_Report.xls");Response.WriteFile(
"swapt.xls");Response.Flush();
Response.Close();

File.Delete(Server.MapPath("swapt.xls"));}

Wednesday, February 13, 2013

Refreshing an Update panel using Javascript in Asp.net

Refreshing Update panel using javascript in asp.net

 

Step:1

<asp:ScriptManager ID="ScriptManager1" runat="server" /> <div id="Container"> <asp:UpdatePanel runat="server" ID="UpdatePanel1" OnLoad="UpdatePanel1_Load"> <ContentTemplate> <asp:Label runat="server" ID="Label1" /> </ContentTemplate> </asp:UpdatePanel>

 

Step 2:

 

protected void UpdatePanel1_Load(object sender, EventArgs e){
  Label1.Text = DateTime.Now.ToString();}
 

Step3:

<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
 

Now Clicking anywhere in the Div it will update the update panel

Tuesday, February 12, 2013

positioning Labe,TextBox in asp.net

In the Client side Just add the Following code

Style
="z-index: 102; left: 160px; position: absolute;top: 210px"

Friday, February 8, 2013

AjaxToolKit Not Working .sys object undefined problem in Asp.net

In The   <system.web>
Paste the Following Text
 I hope It will be Working


<httpHandlers>
<add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules><add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>

Friday, February 1, 2013

How to write XML Schema from DataTable in C#


 Writing XML Schema from data table in C#

ds2.Tables[0].WriteXmlSchema(@"c:\TrialBalance.xsd");

Thursday, January 17, 2013

How to find the Size of the Screen in C#.net

   
 To find the size (Height and Width) of the computer screen write the followingcode


  Rectangle resolution = Screen.PrimaryScreen.Bounds;
            int height = resolution.Size.Height;
            int width = resolution.Size.Width;