[{"data":1,"prerenderedAt":2557},["ShallowReactive",2],{"article-sql-coalesce-command-features":3},{"article":4,"tags":320,"previous":335,"next":1336},{"id":5,"title":6,"author":7,"body":8,"createdAt":309,"description":310,"extension":311,"img":303,"meta":312,"navigation":313,"path":314,"seo":315,"stem":316,"tags":317,"updatedAt":309,"__hash__":319},"articles\u002Farticles\u002Fsql-coalesce-command-features.md","SQL COALESCE Command Features","[object Object]",{"type":9,"value":10,"toc":306},"minimark",[11,15,94,98,108,142,152,297,300],[12,13,14],"p",{},"In order to concatenate strings (delimited by with a string) from multiple rows in a SQL Table to a single field the Coalesce command is the one to use.  Typically COALESCE is used to return a single field value which represents multiple rows concatenated by a string.",[16,17,19,20,19],"div",{"id":18},"codeSnippetWrapper","  \n",[16,21,19,24,19,19,38,19,19,42,19,19,61,19,19,75,19,19,81,19,19,87,19,19,89,19],{"id":22,"style":23},"codeSnippet","text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 122px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,26,28,33,34,37],"pre",{"style":27},"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[29,30,32],"span",{"style":31},"color: #0000ff","DECLARE"," @EmployeeList ",[29,35,36],{"style":31},"varchar","(100)",[25,39,41],{"style":40},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"," ",[25,43,44,47,48,51,52,56,57,60],{"style":27},[29,45,46],{"style":31},"SELECT"," @EmployeeList = ",[29,49,50],{"style":31},"COALESCE","(@EmployeeList + ",[29,53,55],{"style":54},"color: #006080","', '",", ",[29,58,59],{"style":54},"''",") + ",[25,62,63,64,67,68,71,72,74],{"style":40},"   ",[29,65,66],{"style":31},"CAST","(Emp_UniqueID ",[29,69,70],{"style":31},"AS"," ",[29,73,36],{"style":31},"(5))",[25,76,77,80],{"style":27},[29,78,79],{"style":31},"FROM"," SalesCallsEmployees",[25,82,83,86],{"style":40},[29,84,85],{"style":31},"WHERE"," SalCal_UniqueID = 1",[25,88,41],{"style":27},[25,90,91,93],{"style":40},[29,92,46],{"style":31}," @EmployeeList",[95,96],"a",{"href":97},"http:\u002F\u002F11011.net\u002Fsoftware\u002Fvspaste",[12,99,100,101,104,105,107],{},"The output from the following would be something like 1,2, 3",[102,103],"br",{},"\nThe following example uses a function to return a joined table field with the primary data selected.  The challenge was to return a single row from one table while returning values from the joined table into a single field.  To accomplish this I used syntax similar to the following:",[102,106],{},"\ni.e.",[25,109,112,120,124,125,128,129,132,134,137,138,141],{"className":110},[111],"code",[29,113,115,116],{"style":114},"color: blue","SELECT ",[29,117,119],{"style":118},"color: #000000;","personID",[29,121,123],{"style":122},"color: gray",",","dbo",[29,126,127],{"style":122},".","fn_CombineValues",[29,130,131],{"style":122},"(",[29,133,119],{"style":118},[29,135,136],{"style":122},") ","Roles  \n  ",[29,139,140],{"style":114},"FROM ","[People]",[12,143,144,146,148,149,151],{},[95,145],{"href":97},[102,147],{},"\n ",[102,150],{},"\nThe following function was created to support the above sql query.  The function accepts the key to be used in the the joined table and returns a string value representing in this case the roles related to the primary table.",[16,153,19,154,19],{"id":18},[16,155,19,157,19,19,166,19,19,169,19,19,200,19,19,203,19,19,212,19,19,216,19,19,221,19,19,229,19,19,231,19,19,253,19,19,258,19,19,271,19,19,278,19,19,280,19,19,285,19,19,287,19,19,292,19,19,294,19],{"id":22,"style":156},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 305px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,158,159,71,162,165],{"style":27},[29,160,161],{"style":31},"CREATE",[29,163,164],{"style":31},"FUNCTION"," fn_CombineValues",[25,167,168],{"style":40}," (",[25,170,171,172,175,176,71,179,71,182,185,186,189,190,71,193,71,196,199],{"style":27},"     @FK_ID ",[29,173,174],{"style":31},"INT"," --The ",[29,177,178],{"style":31},"foreign",[29,180,181],{"style":31},"key",[29,183,184],{"style":31},"from"," TableA which ",[29,187,188],{"style":31},"is"," used ",[29,191,192],{"style":31},"to",[29,194,195],{"style":31},"fetch",[29,197,198],{"style":31},"corresponding"," records",[25,201,202],{"style":40}," )",[25,204,71,205,71,208,211],{"style":27},[29,206,207],{"style":31},"RETURNS",[29,209,210],{"style":31},"VARCHAR","(8000)",[25,213,71,214],{"style":40},[29,215,70],{"style":31},[25,217,71,218],{"style":27},[29,219,220],{"style":31},"BEGIN",[25,222,71,223,225,226,228],{"style":40},[29,224,32],{"style":31}," @SomeColumnList ",[29,227,210],{"style":31},"(8000);",[25,230,41],{"style":27},[25,232,71,233,235,236,238,239,56,241,60,243,131,245,71,248,71,250,252],{"style":40},[29,234,46],{"style":31}," @SomeColumnList = ",[29,237,50],{"style":31},"(@SomeColumnList + ",[29,240,55],{"style":54},[29,242,59],{"style":54},[29,244,66],{"style":31},[29,246,247],{"style":31},"Role",[29,249,70],{"style":31},[29,251,36],{"style":31},"(20)) ",[25,254,71,255,257],{"style":27},[29,256,79],{"style":31}," dbo.SA_PeopleRoles C",[25,259,71,260,71,263,266,267,270],{"style":40},[29,261,262],{"style":31},"INNER",[29,264,265],{"style":31},"JOIN"," dbo.SA_Roles r ",[29,268,269],{"style":31},"ON"," r.roleid=c.RoleID",[25,272,274,275,277],{"style":273},"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size\u003Cmce: script type=;",": 8pt; overflow: visible; border-style: none; padding: 0px;\"> ",[29,276,85],{"style":31}," C.personID = @FK_ID;",[25,279,41],{"style":40},[25,281,71,282,71],{"style":27},[29,283,284],{"style":31},"RETURN",[25,286,168],{"style":40},[25,288,71,289,291],{"style":27},[29,290,46],{"style":31}," @SomeColumnList",[25,293,202],{"style":40},[25,295,296],{"style":27}," END",[95,298,299],{"href":299},"http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F111341\u002Fcombine-multiple-results-in-a-subquery-into-a-single-comma-separated-value",[301,302],"img",{"src":303,"alt":304,"style":305},"\u002Farticles\u002Fimages\u002Fsql3.png","","display:none;",{"title":304,"searchDepth":307,"depth":307,"links":308},2,[],"2015-04-20T08:07:16.1500000-04:00","Concatenate strings within SQL","md",{},true,"\u002Farticles\u002Fsql-coalesce-command-features",{"title":6,"description":310},"articles\u002Fsql-coalesce-command-features",[318],"sql","Lvcvf-IInMfPOb1Xmt4Hkny-iQtpdEQ4KhdeRiK6CKo",[321],{"id":322,"title":323,"body":324,"description":328,"extension":311,"img":329,"meta":330,"name":318,"navigation":313,"path":331,"seo":332,"stem":333,"__hash__":334},"tags\u002Ftags\u002Fsql.md","Sql",{"type":9,"value":325,"toc":326},[],{"title":304,"searchDepth":307,"depth":307,"links":327},[],"SQL is a standard language designed for managing data in relational database management system. SQL stands for Structured Query Language. SQL is a standard programming language specifically designed for storing, retrieving, managing or manipulating the data inside a relational database management system (RDBMS).","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fsql",{"description":328},"tags\u002Fsql","HleFpAIKGUPMxp855dHtmfuv32MNyIbaOTi0ZjW_I1k",{"id":336,"title":337,"author":7,"body":338,"createdAt":1328,"description":1329,"extension":311,"img":1325,"meta":1330,"navigation":313,"path":1331,"seo":1332,"stem":1333,"tags":1334,"updatedAt":1328,"__hash__":1335},"articles\u002Farticles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c.md","Export SQL Data to Microsoft Excel (using Visual Studio 2008, c#)",{"type":9,"value":339,"toc":1326},[340,349,363,474,547,550,580,683,811,1049,1200,1265,1322],[12,341,342,343,345,346,348],{},"Over the years there have been a number of methods to move SQL data into Microsoft Excel.  Using Automation you can call methods and properties that are specific to excel which gives you the greatest flexibility for specifying the location of your data in the workbook.  The following are two recent approaches to export Sql Server table row data to an excel workbook. ",[102,344],{},"\n1.) Using Automation you can use transfer data cell by cell",[102,347],{},"\n2.) Transfer data in an array to a range of cells",[12,350,351,352,354,355,148,357,359,360,362],{},"I created a WPF application with a button \"Export\" for this code.  The click event creates performs the the following actions",[102,353],{},"\na.) Gets a reference to the automation object\nb.) Adds a default workbook\nc.) Gets the list of tables within the database\nd.) Gets data\ne.) Exports the data to excel worksheets (there are 2 methods defined (1) range method (2) cell by cell\nf.) Saves the excel sheet\ng.) Clean up",[102,356],{},[102,358],{},"\nThis blog posts shows two ways to extract data from SQL Server and place into an Excel document. The Range method was much quicker than the cell by cell approach.  The code below gets a list of all tables within a particular SQL Database and exports the data to Excel. ",[102,361],{},"\nI didn’t use was Excel 2007 document format at this.  If you have a good post or web link using this technique I would happily reference.  Let me know if you would like the Visual Studio project.",[16,364,19,366,19],{"id":18,"style":365},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,367,19,369,19,19,383,19,19,391,19,19,393,19,19,396,19,19,403,19,19,405,19,19,412,19,19,415,19,19,417,19,71,19,420,19,19,425,19,19,430,19,19,437,19,19,439,19,19,444,19,71,19,449,19,19,459,19,19,462,19,19,465,19,19,471,19],{"id":22,"style":368},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,370,371,71,375,378,379,382],{"style":27},[29,372,374],{"style":373},"color: #0000ff;","private",[29,376,377],{"style":373},"void"," btnExport_Click(",[29,380,381],{"style":373},"object"," sender, RoutedEventArgs e) {",[25,384,385,386,390],{"style":40},"    lblMessage.Content=",[29,387,389],{"style":388},"color: #006080;","\"Export Started..\"",";",[25,392,41],{"style":27},[25,394,395],{"style":40},"    WpfApplication.DoEvents();",[25,397,398,399,402],{"style":27},"    ApplicationClass app = CreateExcelDocument(",[29,400,401],{"style":373},"false",");",[25,404,41],{"style":40},[25,406,407,408],{"style":27},"    ",[29,409,411],{"style":410},"color: #008000;","\u002F\u002Fadd workbook to excel document",[25,413,414],{"style":40},"    Workbook workbook = app.Workbooks.Add(Type.Missing);",[25,416,41],{"style":27},[25,418,419],{"style":40},"    DataSet ds = GetData(GetTableList());            ",[25,421,407,422],{"style":40},[29,423,424],{"style":410},"\u002F\u002Fshown below are 2 method of moving data from sql to excel, only use one of them",[25,426,407,427],{"style":27},[29,428,429],{"style":410},"\u002F\u002F(1)call method to export to worksheet using range functionality (much faster than cell by cell method",[25,431,432,433,436],{"style":40},"    Export(ds, ",[29,434,435],{"style":373},"ref"," workbook);",[25,438,41],{"style":27},[25,440,407,441],{"style":40},[29,442,443],{"style":410},"\u002F\u002F(2)cell by cell method",[25,445,407,446],{"style":27},[29,447,448],{"style":410},"\u002F\u002FInsertIntoExcel(app, ds);",[25,450,451,452,455,456,390],{"style":27},"     ",[29,453,454],{"style":373},"string"," fileName = ",[29,457,458],{"style":388},"@\"C:\\Safety3.xlsx\"",[25,460,461],{"style":40},"     SaveDoc(workbook, fileName);",[25,463,464],{"style":27},"     CloseExcelDocument(app);",[25,466,467,468,390],{"style":40},"     lblMessage.Content = ",[29,469,470],{"style":388},"\"Finished..\"",[25,472,473],{"style":27},"}",[16,475,19,476,19],{"id":18,"style":365},[16,477,19,478,19,19,483,19,19,488,19,19,493,19,19,502,19,19,508,19,19,514,19,19,521,19,19,524,19,19,526,19,19,533,19,19,536,19,19,539,19,19,545,19],{"id":22,"style":368},[25,479,480],{"style":27},[29,481,482],{"style":410},"\u002F\u002F\u002F \u003Csummary>",[25,484,485],{"style":40},[29,486,487],{"style":410},"\u002F\u002F\u002F creates excel document",[25,489,490],{"style":27},[29,491,492],{"style":410},"\u002F\u002F\u002F \u003C\u002Fsummary>",[25,494,495,497,498,501],{"style":40},[29,496,374],{"style":373}," ApplicationClass CreateExcelDocument(",[29,499,500],{"style":373},"bool"," visible) {",[25,503,504,505,390],{"style":27},"    ApplicationClass app = ",[29,506,507],{"style":373},"null",[25,509,407,510,513],{"style":40},[29,511,512],{"style":373},"try"," {",[25,515,516,517,520],{"style":27},"        app = ",[29,518,519],{"style":373},"new"," Microsoft.Office.Interop.Excel.ApplicationClass();",[25,522,523],{"style":40},"        app.Visible = visible;",[25,525,41],{"style":27},[25,527,528,529,532],{"style":40},"    } ",[29,530,531],{"style":373},"catch"," (Exception ex) {",[25,534,535],{"style":27},"        MessageBox.Show(ex.ToString());",[25,537,538],{"style":40},"    }",[25,540,407,541,544],{"style":27},[29,542,543],{"style":373},"return"," app;",[25,546,473],{"style":40},[12,548,549],{},"c.) The following method GetTableList() returns a List\u003CExportInfo> where ExportInfo is a structure that has the Name and SQL to be used for each table to be exported.",[16,551,19,552,19],{"id":18},[16,553,19,555,19,19,564,19,19,571,19,19,578,19],{"id":22,"style":554},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 63px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,556,557,71,560,563],{"style":27},[29,558,559],{"style":373},"public",[29,561,562],{"style":373},"class"," ExportInfo {",[25,565,407,566,71,568,570],{"style":40},[29,567,559],{"style":373},[29,569,454],{"style":373}," Name { get; set; }",[25,572,407,573,71,575,577],{"style":27},[29,574,559],{"style":373},[29,576,454],{"style":373}," Sql { get; set; }",[25,579,473],{"style":40},[16,581,19,583,19],{"id":18,"style":582},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 324px; max-height: 350px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,584,19,585,19,19,589,19,19,594,19,19,598,19,19,603,19,19,608,19,19,617,19,71,19,626,19,19,629,19,19,635,19,19,638,19,19,641,19,19,644,19,19,646,19,19,648,19,19,654,19,19,664,19,19,674,19,19,676,19,19,681,19],{"id":22,"style":368},[25,586,587],{"style":27},[29,588,482],{"style":410},[25,590,591],{"style":40},[29,592,593],{"style":410},"\u002F\u002F\u002F get list of sql tables in database",[25,595,596],{"style":27},[29,597,492],{"style":410},[25,599,600],{"style":40},[29,601,602],{"style":410},"\u002F\u002F\u002F \u003Creturns>list of ExportInfo objects\u003C\u002Freturns>",[25,604,605,607],{"style":27},[29,606,374],{"style":373}," List\u003CExportInfo> GetTableList() {",[25,609,610,611,613,614,402],{"style":40},"    System.Data.DataTable tables = ",[29,612,519],{"style":373}," System.Data.DataTable(",[29,615,616],{"style":388},"\"Tables\"",[25,618,407,619,622,623,625],{"style":27},[29,620,621],{"style":373},"using"," (SqlConnection connection = ",[29,624,519],{"style":373}," SqlConnection(GetConnectionString())) {",[25,627,628],{"style":27},"        SqlCommand command = connection.CreateCommand();",[25,630,631,632,390],{"style":40},"        command.CommandText = ",[29,633,634],{"style":388},"\"select table_name as Name from INFORMATION_SCHEMA.tables where TABLE_TYPE = 'BASE TABLE'\"",[25,636,637],{"style":27},"        connection.Open();",[25,639,640],{"style":40},"        tables.Load(command.ExecuteReader(CommandBehavior.CloseConnection));",[25,642,643],{"style":27},"        connection.Close();",[25,645,538],{"style":40},[25,647,41],{"style":27},[25,649,650,651,653],{"style":40},"    List\u003CExportInfo> exps = ",[29,652,519],{"style":373}," List\u003CExportInfo>();",[25,655,407,656,659,660,663],{"style":27},[29,657,658],{"style":373},"foreach"," (DataRow row ",[29,661,662],{"style":373},"in"," tables.Rows) {",[25,665,666,667,669,670,673],{"style":40},"        exps.Add(",[29,668,519],{"style":373}," ExportInfo(){Name=row[0].ToString(), Sql = String.Format(",[29,671,672],{"style":388},"\"select top 1 * from {0}\"",",row[0].ToString())});",[25,675,538],{"style":27},[25,677,407,678,680],{"style":40},[29,679,543],{"style":373}," exps;            ",[25,682,473],{"style":27},[16,684,19,686,19],{"id":18,"style":685},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 247px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,687,19,688,19,19,692,19,19,697,19,19,701,19,19,706,19,19,711,19,19,716,19,19,722,19,19,730,19,19,738,19,19,744,19,19,746,19,19,748,19,19,753,19,19,759,19,19,765,19,19,769,19,19,772,19,19,776,19,19,778,19,19,780,19,19,782,19,19,788,19,19,796,19,19,799,19,19,802,19,19,804,19,19,809,19],{"id":22,"style":368},[25,689,690],{"style":27},[29,691,482],{"style":410},[25,693,694],{"style":40},[29,695,696],{"style":410},"\u002F\u002F\u002F get data from sql server",[25,698,699],{"style":27},[29,700,492],{"style":410},[25,702,703],{"style":40},[29,704,705],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"exps\">\u003C\u002Fparam>",[25,707,708],{"style":27},[29,709,710],{"style":410},"\u002F\u002F\u002F \u003Creturns>dataset with return results\u003C\u002Freturns>",[25,712,713,715],{"style":40},[29,714,374],{"style":373}," System.Data.DataSet GetData(List\u003CExportInfo> exps) {",[25,717,718,719,721],{"style":27},"    DataSet ds = ",[29,720,519],{"style":373}," DataSet();",[25,723,407,724,726,727,729],{"style":40},[29,725,454],{"style":373}," executeSql = ",[29,728,454],{"style":373},".Empty;",[25,731,407,732,734,735,737],{"style":27},[29,733,658],{"style":373}," (ExportInfo exp ",[29,736,662],{"style":373}," exps) {",[25,739,740,741,390],{"style":40},"        executeSql += exp.Sql + ",[29,742,743],{"style":388},"\";\"",[25,745,538],{"style":27},[25,747,41],{"style":40},[25,749,407,750,752],{"style":27},[29,751,454],{"style":373}," connectionString = GetConnectionString();",[25,754,755,756,758],{"style":40},"    SqlConnection conn = ",[29,757,519],{"style":373}," SqlConnection(connectionString);",[25,760,761,762,764],{"style":27},"    SqlDataAdapter adapter = ",[29,763,519],{"style":373}," SqlDataAdapter(executeSql, conn);",[25,766,407,767,513],{"style":40},[29,768,512],{"style":373},[25,770,771],{"style":27},"        adapter.Fill(ds);",[25,773,528,774,532],{"style":40},[29,775,531],{"style":373},[25,777,41],{"style":27},[25,779,538],{"style":40},[25,781,41],{"style":27},[25,783,407,784,787],{"style":40},[29,785,786],{"style":373},"int"," index = 0;",[25,789,407,790,792,793,795],{"style":27},[29,791,658],{"style":373}," (System.Data.DataTable dt ",[29,794,662],{"style":373}," ds.Tables) {",[25,797,798],{"style":40},"        dt.TableName = exps[index].Name;",[25,800,801],{"style":27},"        index += 1;",[25,803,538],{"style":40},[25,805,407,806,808],{"style":27},[29,807,543],{"style":373}," ds;",[25,810,473],{"style":40},[16,812,19,814,19],{"id":18,"style":813},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 500px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,815,19,816,19,19,820,19,19,825,19,19,829,19,19,834,19,19,839,19,19,849,19,19,851,19,19,856,19,19,858,19,19,863,19,19,870,19,19,872,19,19,878,19,19,888,19,19,890,19,19,895,19,19,903,19,19,906,19,19,909,19,19,911,19,19,916,19,19,922,19,19,930,19,19,933,19,19,936,19,19,938,19,19,940,19,19,945,19,19,952,19,19,960,19,19,965,19,19,967,19,19,973,19,19,976,19,19,979,19,19,981,19,19,983,19,19,986,19,19,989,19,19,991,19,19,996,19,19,999,19,19,1002,19,19,1004,19,19,1010,19,19,1012,19,19,1017,19,19,1029,19,19,1032,19,19,1034,19,19,1039,19,19,1045,19,19,1047,19],{"id":22,"style":368},[25,817,818],{"style":27},[29,819,482],{"style":410},[25,821,822],{"style":40},[29,823,824],{"style":410},"\u002F\u002F\u002F Copy data from dataset into workbook",[25,826,827],{"style":27},[29,828,492],{"style":410},[25,830,831],{"style":40},[29,832,833],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"dataSet\">\u003C\u002Fparam>",[25,835,836],{"style":27},[29,837,838],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"excelWorkbook\">\u003C\u002Fparam>        ",[25,840,841,71,843,845,846,848],{"style":40},[29,842,374],{"style":373},[29,844,377],{"style":373}," Export(DataSet dataSet, ",[29,847,435],{"style":373}," Workbook excelWorkbook) {",[25,850,41],{"style":27},[25,852,407,853,855],{"style":40},[29,854,786],{"style":373}," sheetIndex = 0;",[25,857,41],{"style":27},[25,859,407,860],{"style":40},[29,861,862],{"style":410},"\u002F\u002F build rawData 2 dimensional array with data for each datatable            ",[25,864,407,865,792,867,869],{"style":27},[29,866,658],{"style":373},[29,868,662],{"style":373}," dataSet.Tables) {",[25,871,41],{"style":40},[25,873,874,875],{"style":27},"        ",[29,876,877],{"style":410},"\u002F\u002F Copy the DataTable to an object array",[25,879,874,880,882,883,71,885,887],{"style":40},[29,881,381],{"style":373},"[,] data = ",[29,884,519],{"style":373},[29,886,381],{"style":373},"[dt.Rows.Count + 1, dt.Columns.Count];",[25,889,41],{"style":27},[25,891,874,892],{"style":40},[29,893,894],{"style":410},"\u002F\u002F Copy the column names to the first row of the object array",[25,896,874,897,168,900,902],{"style":27},[29,898,899],{"style":373},"for",[29,901,786],{"style":373}," col = 0; col \u003C dt.Columns.Count; col++) {",[25,904,905],{"style":40},"            data[0, col] = dt.Columns[col].ColumnName;",[25,907,908],{"style":27},"        }",[25,910,41],{"style":40},[25,912,874,913],{"style":27},[29,914,915],{"style":410},"\u002F\u002F Copy the values to the object array",[25,917,874,918,168,920,902],{"style":40},[29,919,899],{"style":373},[29,921,786],{"style":373},[25,923,924,925,168,927,929],{"style":27},"            ",[29,926,899],{"style":373},[29,928,786],{"style":373}," row = 0; row \u003C dt.Rows.Count; row++) {",[25,931,932],{"style":40},"                data[row + 1, col] = dt.Rows[row].ItemArray[col];",[25,934,935],{"style":27},"            }",[25,937,908],{"style":40},[25,939,41],{"style":27},[25,941,874,942],{"style":40},[29,943,944],{"style":410},"\u002F\u002F Calculate the final column letter",[25,946,874,947,949,950,729],{"style":27},[29,948,454],{"style":373}," finalColLetter = ",[29,951,454],{"style":373},[25,953,874,954,956,957,390],{"style":40},[29,955,454],{"style":373}," colCharset = ",[29,958,959],{"style":388},"\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",[25,961,874,962,964],{"style":27},[29,963,786],{"style":373}," colCharsetLen = colCharset.Length;",[25,966,41],{"style":40},[25,968,874,969,972],{"style":27},[29,970,971],{"style":373},"if"," (dt.Columns.Count > colCharsetLen) {",[25,974,975],{"style":40},"            finalColLetter = colCharset.Substring(",[25,977,978],{"style":27},"                (dt.Columns.Count - 1) \u002F colCharsetLen - 1, 1);",[25,980,908],{"style":40},[25,982,41],{"style":27},[25,984,985],{"style":40},"        finalColLetter += colCharset.Substring(",[25,987,988],{"style":27},"                (dt.Columns.Count - 1) % colCharsetLen, 1);",[25,990,41],{"style":40},[25,992,874,993],{"style":27},[29,994,995],{"style":410},"\u002F\u002F Create a new Sheet",[25,997,998],{"style":40},"        Worksheet excelSheet = (Worksheet)excelWorkbook.Sheets.Add(excelWorkbook.Sheets.get_Item(++sheetIndex),",[25,1000,1001],{"style":27},"                                                                    Type.Missing, 1, XlSheetType.xlWorksheet);",[25,1003,41],{"style":40},[25,1005,1006,1007],{"style":27},"        excelSheet.Name = dt.TableName; ",[29,1008,1009],{"style":410},"\u002F\u002F name new sheet name of table",[25,1011,41],{"style":40},[25,1013,874,1014],{"style":27},[29,1015,1016],{"style":410},"\u002F\u002F Fast data export to Excel",[25,1018,874,1019,1021,1022,1024,1025,1028],{"style":40},[29,1020,454],{"style":373}," excelRange = ",[29,1023,454],{"style":373},".Format(",[29,1026,1027],{"style":388},"\"A1:{0}{1}\"",", finalColLetter, dt.Rows.Count + 1);",[25,1030,1031],{"style":27},"        excelSheet.get_Range(excelRange, Type.Missing).Value2 = data;",[25,1033,41],{"style":40},[25,1035,874,1036],{"style":27},[29,1037,1038],{"style":410},"\u002F\u002F Mark the first row as BOLD",[25,1040,1041,1042,390],{"style":40},"        ((Range)excelSheet.Rows[1, Type.Missing]).Font.Bold = ",[29,1043,1044],{"style":373},"true",[25,1046,538],{"style":27},[25,1048,473],{"style":40},[16,1050,19,1051,19],{"id":18,"style":365},[16,1052,19,1053,19,19,1057,19,19,1062,19,19,1066,19,19,1071,19,19,1076,19,19,1083,19,19,1089,19,19,1092,19,19,1095,19,19,1097,19,19,1102,19,19,1107,19,19,1114,19,71,19,1118,19,19,1121,19,19,1129,19,19,1132,19,19,1135,19,19,1137,19,19,1139,19,19,1142,19,19,1149,19,19,1152,19,19,1155,19,19,1162,19,19,1165,19,19,1168,19,19,1171,19,19,1173,19,19,1178,19,19,1180,19,19,1191,19,19,1193,19,19,1198,19],{"id":22,"style":368},[25,1054,1055],{"style":27},[29,1056,482],{"style":410},[25,1058,1059],{"style":40},[29,1060,1061],{"style":410},"\u002F\u002F\u002F inserts data into excel row by row",[25,1063,1064],{"style":27},[29,1065,492],{"style":410},[25,1067,1068],{"style":40},[29,1069,1070],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"excel\">\u003C\u002Fparam>",[25,1072,1073],{"style":27},[29,1074,1075],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"ds\">\u003C\u002Fparam>",[25,1077,1078,71,1080,1082],{"style":40},[29,1079,374],{"style":373},[29,1081,377],{"style":373}," InsertIntoExcel(Microsoft.Office.Interop.Excel.Application excel, System.Data.DataSet ds) {",[25,1084,407,1085,792,1087,795],{"style":27},[29,1086,658],{"style":373},[29,1088,662],{"style":373},[25,1090,1091],{"style":40},"        Microsoft.Office.Interop.Excel.Worksheet theSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks[1].Worksheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);",[25,1093,1094],{"style":27},"        theSheet.Name = dt.TableName;",[25,1096,41],{"style":40},[25,1098,874,1099,1101],{"style":27},[29,1100,786],{"style":373}," colIndex = 0;",[25,1103,874,1104,1106],{"style":40},[29,1105,786],{"style":373}," rowIndex = 1;",[25,1108,874,1109,1111,1112,729],{"style":27},[29,1110,454],{"style":373}," err = ",[29,1113,454],{"style":373},[25,1115,874,1116,513],{"style":40},[29,1117,512],{"style":373},[25,1119,1120],{"style":40},"            colIndex = 0;",[25,1122,924,1123,1125,1126,1128],{"style":27},[29,1124,658],{"style":373}," (DataColumn col ",[29,1127,662],{"style":373}," dt.Columns) {",[25,1130,1131],{"style":40},"                colIndex += 1;",[25,1133,1134],{"style":27},"                excel.Cells[1, colIndex] = col.ColumnName;",[25,1136,935],{"style":40},[25,1138,41],{"style":27},[25,1140,1141],{"style":40},"            rowIndex = 1;",[25,1143,924,1144,659,1146,1148],{"style":27},[29,1145,658],{"style":373},[29,1147,662],{"style":373}," dt.Rows) {",[25,1150,1151],{"style":40},"                rowIndex += 1;",[25,1153,1154],{"style":27},"                colIndex = 0;",[25,1156,1157,1158,1125,1160,1128],{"style":40},"                ",[29,1159,658],{"style":373},[29,1161,662],{"style":373},[25,1163,1164],{"style":27},"                    colIndex += 1;",[25,1166,1167],{"style":40},"                    excel.Cells[rowIndex, colIndex] = row[col.ColumnName].ToString();",[25,1169,1170],{"style":27},"                }",[25,1172,935],{"style":40},[25,1174,1175,1176,532],{"style":27},"        } ",[29,1177,531],{"style":373},[25,1179,41],{"style":40},[25,1181,1182,1183,1186,1187,1190],{"style":27},"            err += ",[29,1184,1185],{"style":388},"\"RowIndex=\""," + rowIndex.ToString() + ",[29,1188,1189],{"style":388},"\" ColIndex=\""," + colIndex.ToString();",[25,1192,908],{"style":40},[25,1194,528,1195],{"style":27},[29,1196,1197],{"style":410},"\u002F\u002F next ",[25,1199,473],{"style":40},[16,1201,19,1202,19],{"id":18},[16,1203,19,1205,19,19,1209,19,19,1214,19,19,1218,19,19,1223,19,19,1228,19,19,1238,19,19,1243,19,19,1246,19,19,1249,19,19,1252,19,19,1258,19,19,1263,19],{"id":22,"style":1204},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 207px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,1206,1207],{"style":27},[29,1208,482],{"style":410},[25,1210,1211],{"style":40},[29,1212,1213],{"style":410},"\u002F\u002F\u002F Save workbook to file system",[25,1215,1216],{"style":27},[29,1217,492],{"style":410},[25,1219,1220],{"style":40},[29,1221,1222],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"excelWorkbook\">\u003C\u002Fparam>",[25,1224,1225],{"style":27},[29,1226,1227],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"fileName\">\u003C\u002Fparam>",[25,1229,1230,71,1232,1234,1235,1237],{"style":40},[29,1231,374],{"style":373},[29,1233,377],{"style":373}," SaveDoc(Workbook excelWorkbook, ",[29,1236,454],{"style":373}," fileName) {",[25,1239,407,1240],{"style":27},[29,1241,1242],{"style":410},"\u002F\u002F Save and Close the Workbook",[25,1244,1245],{"style":40},"    excelWorkbook.SaveAs(fileName, XlFileFormat.xlWorkbookNormal, Type.Missing,",[25,1247,1248],{"style":27},"        Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive,",[25,1250,1251],{"style":40},"        Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);",[25,1253,1254,1255,1257],{"style":27},"    excelWorkbook.Close(",[29,1256,1044],{"style":373},", Type.Missing, Type.Missing);",[25,1259,1260,1261,390],{"style":40},"    excelWorkbook = ",[29,1262,507],{"style":373},[25,1264,473],{"style":27},[16,1266,19,1267,19],{"id":18},[16,1268,19,1269,19,19,1273,19,19,1278,19,19,1282,19,19,1287,19,19,1294,19,19,1299,19,19,1302,19,19,1307,19,19,1309,19,19,1314,19,19,1317,19,19,1320,19],{"id":22,"style":1204},[25,1270,1271],{"style":27},[29,1272,482],{"style":410},[25,1274,1275],{"style":40},[29,1276,1277],{"style":410},"\u002F\u002F\u002F Clean up and close document",[25,1279,1280],{"style":27},[29,1281,492],{"style":410},[25,1283,1284],{"style":40},[29,1285,1286],{"style":410},"\u002F\u002F\u002F \u003Cparam name=\"excelApp\">\u003C\u002Fparam>",[25,1288,1289,71,1291,1293],{"style":27},[29,1290,374],{"style":373},[29,1292,377],{"style":373}," CloseExcelDocument(ApplicationClass excelApp) {",[25,1295,407,1296],{"style":40},[29,1297,1298],{"style":410},"\u002F\u002F Release the Application object",[25,1300,1301],{"style":27},"    excelApp.Quit();",[25,1303,1304,1305,390],{"style":40},"    excelApp = ",[29,1306,507],{"style":373},[25,1308,41],{"style":27},[25,1310,407,1311],{"style":40},[29,1312,1313],{"style":410},"\u002F\u002F Collect the unreferenced objects",[25,1315,1316],{"style":27},"    GC.Collect();",[25,1318,1319],{"style":40},"    GC.WaitForPendingFinalizers();",[25,1321,473],{"style":27},[301,1323],{"style":1324,"src":1325,"alt":304},"display: none;","\u002Farticles\u002Fimages\u002Fexport.jpg",{"title":304,"searchDepth":307,"depth":307,"links":1327},[],"2015-04-20T08:07:16.2600000-04:00","How to migrate data to Excel.",{},"\u002Farticles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c",{"title":337,"description":1329},"articles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c",[318],"WrTKgWupiJpRf38vBT1Ecbke8nc6PFnUO6TDGtQ-kK8",{"id":1337,"title":1338,"author":7,"body":1339,"createdAt":2548,"description":2549,"extension":311,"img":2545,"meta":2550,"navigation":313,"path":2551,"seo":2552,"stem":2553,"tags":2554,"updatedAt":2548,"__hash__":2556},"articles\u002Farticles\u002Fasp-net-updatepanel-updateprogress-controls-and-overlays-wait-messages.md","Asp.net UpdatePanel, UpdateProgress Controls and Overlays (Wait Messages)",{"type":9,"value":1340,"toc":2546},[1341,1348,1363,1369,1372,1628,1724,1874,2021,2023,2083,2085,2087,2158,2179,2182,2233,2236,2543],[12,1342,1343,1347],{},[1344,1345,1346],"strong",{},"Scenario",": While a partial page postback is occurring disable all form fields and give the user a pleasant please wait message that can be used consistently across your application.  We need to create an overlay that works in conjunction with the updatepanel as well as direct from JavaScript.",[12,1349,1350,1353,1354,71,1357,1360,1362],{},[1344,1351,1352],{},"Problem",": Design the update progress html and css so that the entire page is overlaid with gray background.  This works pretty good ",[1344,1355,1356],{},"until scrolling",[1344,1358,1359],{},"on the page is involved.  When the page is tall enough that the browser scrolls the overlay must by sized dynamically with each post.  If you fail to do this, you will end up with odd visual with the overlay only covering a portion of the page.",[102,1361],{},"\nThe problem above is resolved in the solution described within this post.  It covers the asp.net, html, css and JavaScript code to accomplish the above in re-usable fashion.",[12,1364,1365,1366,1368],{},"I was using the UpdatePanel control which enables you to build rich, client-centric web applications.  By using the UpdatePanel controls you can refresh selected parts of the page instead of refreshing the whole page with a postback.  While the partial page post back occurs an UpdateProgress control is available to provide the user with a friendly ‘please wait’ message.  This all works seamlessly out of the box. ",[102,1367],{},"\nIn my scenario I needed to overlay and disable all controls (make unavailable) for the user while the partial page update happens.  The application allows for file uploads (which cannot participate in partial page updates).  A full post back must occur for this to work correctly. ",[12,1370,1371],{},"My ASPX page has the following structure with typical UpdatePanel, ContentTemplate, Triggers and UpdateProgress controls.  The trigger designates that the btnSubmitAdmin will perform a full postback.  I want the full postback user interaction to look similar as the partial page updates.  As a result, I will be using the same updateprogress visual for both partial and full postbacks.",[16,1373,19,1375,19],{"id":18,"style":1374},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 94.2%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 374px; max-height: 500px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,1376,19,1377,19,19,1396,19,19,1417,19,71,19,1447,19,19,1472,19,71,19,1483,19,71,19,1488,19,19,1499,19,19,1508,19,19,1524,19,19,1532,19,71,19,1541,19,19,1575,19,19,1584,19,19,1604,19,19,1612,19,19,1620,19],{"id":22,"style":368},[25,1378,1379,1382,71,1386,1390,1393],{"style":27},[29,1380,1381],{"style":373},"\u003C",[29,1383,1385],{"style":1384},"color: #800000;","body",[29,1387,1389],{"style":1388},"color: #ff0000;","onload",[29,1391,1392],{"style":373},"=\"fncOnLoad()\"",[29,1394,1395],{"style":373},">",[25,1397,1398,1400,71,1403,1406,71,1409,1412,1415],{"style":40},[29,1399,1381],{"style":373},[29,1401,1402],{"style":1384},"form",[29,1404,1405],{"style":1388},"id",[29,1407,1408],{"style":373},"=\"form1\"",[29,1410,1411],{"style":1388},"runat",[29,1413,1414],{"style":373},"=\"server\"",[29,1416,1395],{"style":373},[25,1418,407,1419,1421,71,1424,1427,71,1430,1432,71,1434,1437,1440,1443,1445],{"style":27},[29,1420,1381],{"style":373},[29,1422,1423],{"style":1384},"asp:ScriptManager",[29,1425,1426],{"style":1388},"ID",[29,1428,1429],{"style":373},"=\"Scriptmanager1\"",[29,1431,1411],{"style":1388},[29,1433,1414],{"style":373},[29,1435,1436],{"style":1388},"EnablePartialRendering",[29,1438,1439],{"style":373},"=\"true\"",[29,1441,1442],{"style":373},">\u003C\u002F",[29,1444,1423],{"style":1384},[29,1446,1395],{"style":373},[25,1448,407,1449,1451,71,1454,1456,71,1459,1461,1463,1464,1467,71,1470],{"style":27},[29,1450,1381],{"style":373},[29,1452,1453],{"style":1384},"asp:UpdatePanel",[29,1455,1426],{"style":1388},[29,1457,1458],{"style":373},"=\"updatePanel1\"",[29,1460,1411],{"style":1388},[29,1462,1414],{"style":373},"  ",[29,1465,1466],{"style":1388},"UpdateMode",[29,1468,1469],{"style":373},"=\"Conditional\"",[29,1471,1395],{"style":373},[25,1473,1474,1475,1477,1480,1482],{"style":40},"       ",[29,1476,1381],{"style":373},[29,1478,1479],{"style":1384},"ContentTemplate",[29,1481,1395],{"style":373},"               ",[25,1484,874,1485,1157],{"style":40},[29,1486,1487],{"style":410},"\u003C!-- Content Goes Here -->",[25,1489,1490,1491,1494,1496,1498],{"style":40},"          ",[29,1492,1493],{"style":373},"\u003C\u002F",[29,1495,1479],{"style":1384},[29,1497,1395],{"style":373},"              ",[25,1500,874,1501,1503,1506],{"style":27},[29,1502,1381],{"style":373},[29,1504,1505],{"style":1384},"Triggers",[29,1507,1395],{"style":373},[25,1509,924,1510,1512,71,1515,1518,71,1521,924],{"style":40},[29,1511,1381],{"style":373},[29,1513,1514],{"style":1384},"asp:PostBackTrigger",[29,1516,1517],{"style":1388},"ControlID",[29,1519,1520],{"style":373},"=\"btnSubmitAdmin\"",[29,1522,1523],{"style":373},"\u002F>",[25,1525,874,1526,1528,1530,451],{"style":27},[29,1527,1493],{"style":373},[29,1529,1505],{"style":1384},[29,1531,1395],{"style":373},[25,1533,63,1534,1536,1538,1540],{"style":40},[29,1535,1493],{"style":373},[29,1537,1453],{"style":1384},[29,1539,1395],{"style":373},"                    ",[25,1542,63,1543,1545,71,1548,1550,71,1553,1555,71,1557,1560,71,1562,1565,71,1567,1570,1573],{"style":40},[29,1544,1381],{"style":373},[29,1546,1547],{"style":1384},"asp:UpdateProgress",[29,1549,1426],{"style":1388},[29,1551,1552],{"style":373},"=\"UpdateProgress1\"",[29,1554,1411],{"style":1388},[29,1556,1414],{"style":373},[29,1558,1559],{"style":1388},"AssociatedUpdatePanelID",[29,1561,1458],{"style":373},[29,1563,1564],{"style":1388},"DynamicLayout",[29,1566,1439],{"style":373},[29,1568,1569],{"style":1388},"DisplayAfter",[29,1571,1572],{"style":373},"=\"1000\"",[29,1574,1395],{"style":373},[25,1576,874,1577,1579,71,1582],{"style":27},[29,1578,1381],{"style":373},[29,1580,1581],{"style":1384},"ProgressTemplate",[29,1583,1395],{"style":373},[25,1585,1587,1588,1590,71,1593,1595,71,1598,1600,71,1602],{"style":1586},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 18px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;","             ",[29,1589,1381],{"style":373},[29,1591,1592],{"style":1384},"uc1:WaitPanel",[29,1594,1426],{"style":1388},[29,1596,1597],{"style":373},"=\"WaitPanel1\"",[29,1599,1411],{"style":1388},[29,1601,1414],{"style":373},[29,1603,1523],{"style":373},[25,1605,874,1606,1608,1610],{"style":27},[29,1607,1493],{"style":373},[29,1609,1581],{"style":1384},[29,1611,1395],{"style":373},[25,1613,407,1614,1616,1618,407],{"style":40},[29,1615,1493],{"style":373},[29,1617,1547],{"style":1384},[29,1619,1395],{"style":373},[25,1621,1622,1624,1626],{"style":27},[29,1623,1493],{"style":373},[29,1625,1402],{"style":1384},[29,1627,1395],{"style":373},[16,1629,19,1631,19],{"id":18,"style":1630},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 350px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,1632,19,1633,19,71,19,1639,19,19,1652,19,19,1665,19,19,1681,19,19,1689,19,19,1708,19,19,1716,19],{"id":22,"style":368},[25,1634,1635],{"style":27},[29,1636,1638],{"style":1637},"background-color: #ffff00;","\u003C%@ Control Language=\"VB\" AutoEventWireup=\"false\" CodeFile=\"WaitPanel.ascx.vb\" Inherits=\"Uc_WaitPanel\" %>",[25,1640,874,1641,1643,71,1645,1647,1650],{"style":27},[29,1642,1381],{"style":373},[29,1644,16],{"style":1384},[29,1646,1405],{"style":1388},[29,1648,1649],{"style":373},"=\"OuterTableCellOverlay\"",[29,1651,1395],{"style":373},[25,1653,924,1654,1656,71,1658,1660,1663],{"style":40},[29,1655,1381],{"style":373},[29,1657,16],{"style":1384},[29,1659,1405],{"style":1388},[29,1661,1662],{"style":373},"=\"InnerTableCellOverlay\"",[29,1664,1395],{"style":373},[25,1666,1157,1667,1669,1672,1674,1675,1677,1679],{"style":27},[29,1668,1381],{"style":373},[29,1670,1671],{"style":1384},"b",[29,1673,1395],{"style":373},"... Please Wait ...",[29,1676,1493],{"style":373},[29,1678,1671],{"style":1384},[29,1680,1395],{"style":373},[25,1682,1157,1683,1685,71,1687],{"style":40},[29,1684,1381],{"style":373},[29,1686,102],{"style":1384},[29,1688,1523],{"style":373},[25,1690,1157,1691,1693,71,1696,1698,71,1700,1703,71,1706,1157],{"style":27},[29,1692,1381],{"style":373},[29,1694,1695],{"style":1384},"asp:Image",[29,1697,1411],{"style":1388},[29,1699,1414],{"style":373},[29,1701,1702],{"style":1388},"ImageUrl",[29,1704,1705],{"style":373},"=\"~\u002FImages\u002Findicator_waitanim.gif\"",[29,1707,1523],{"style":373},[25,1709,924,1710,1712,1714],{"style":40},[29,1711,1493],{"style":373},[29,1713,16],{"style":1384},[29,1715,1395],{"style":373},[25,1717,874,1718,1720,1722,1463],{"style":27},[29,1719,1493],{"style":373},[29,1721,16],{"style":1384},[29,1723,1395],{"style":373},[16,1725,19,1726,19],{"id":18,"style":1630},[16,1727,19,1728,19,19,1735,19,19,1741,19,19,1743,19,19,1775,19,19,1777,19,19,1789,19,19,1795,19,19,1802,19,19,1812,19,19,1820,19,19,1828,19,19,1835,19,19,1838,19,19,1840,19,19,1854,19,19,1861,19,19,1863,19,19,1869,19],{"id":22,"style":368},[25,1729,1730,1731,1734],{"style":27},"Partial ",[29,1732,1733],{"style":373},"Class"," Uc_WaitPanel",[25,1736,407,1737,1740],{"style":40},[29,1738,1739],{"style":373},"Inherits"," System.Web.UI.UserControl",[25,1742,41],{"style":27},[25,1744,407,1745,71,1748,1751,1752,1755,1756,71,1759,56,1762,1764,1765,1767,1768,71,1771,1774],{"style":40},[29,1746,1747],{"style":373},"Protected",[29,1749,1750],{"style":373},"Sub"," Uc_WaitPanel_Load(",[29,1753,1754],{"style":373},"ByVal"," sender ",[29,1757,1758],{"style":373},"As",[29,1760,1761],{"style":373},"Object",[29,1763,1754],{"style":373}," e ",[29,1766,1758],{"style":373}," System.EventArgs) ",[29,1769,1770],{"style":373},"Handles",[29,1772,1773],{"style":373},"Me",".Load",[25,1776,41],{"style":27},[25,1778,874,1779,1782,1783,71,1785,1788],{"style":40},[29,1780,1781],{"style":373},"Dim"," css ",[29,1784,1758],{"style":373},[29,1786,1787],{"style":373},"New"," HtmlLink()",[25,1790,874,1791,1794],{"style":27},[29,1792,1793],{"style":373},"With"," css",[25,1796,1797,1798,1801],{"style":40},"            .Href = ResolveClientUrl(",[29,1799,1800],{"style":388},"\"~\u002FStyle\u002FWait.css\"",")",[25,1803,1804,1805,1808,1809],{"style":27},"            .Attributes(",[29,1806,1807],{"style":388},"\"rel\"",") = ",[29,1810,1811],{"style":388},"\"stylesheet\"",[25,1813,1804,1814,1808,1817],{"style":40},[29,1815,1816],{"style":388},"\"type\"",[29,1818,1819],{"style":388},"\"text\u002Fcss\"",[25,1821,1804,1822,1808,1825],{"style":27},[29,1823,1824],{"style":388},"\"media\"",[29,1826,1827],{"style":388},"\"all\"",[25,1829,874,1830,71,1833],{"style":40},[29,1831,1832],{"style":373},"End",[29,1834,1793],{"style":373},[25,1836,1837],{"style":27},"        Page.Header.Controls.Add(css)",[25,1839,41],{"style":40},[25,1841,874,1842,1844,1845,71,1847,1850,1851,1801],{"style":27},[29,1843,1781],{"style":373}," url ",[29,1846,1758],{"style":373},[29,1848,1849],{"style":373},"String"," = ResolveClientUrl(",[29,1852,1853],{"style":388},"\"~\u002FScripts\u002FWait.js\"",[25,1855,1856,1857,1860],{"style":40},"        Page.ClientScript.RegisterClientScriptInclude(",[29,1858,1859],{"style":388},"\"wait\"",", url)",[25,1862,41],{"style":27},[25,1864,407,1865,71,1867],{"style":40},[29,1866,1832],{"style":373},[29,1868,1750],{"style":373},[25,1870,1871,1873],{"style":27},[29,1872,1832],{"style":373}," Class",[16,1875,19,1876,19],{"id":18},[16,1877,19,1878,19,19,1883,19,19,1886,19,19,1889,19,19,1898,19,19,1901,19,19,1907,19,19,1913,19,19,1921,19,19,1928,19,19,1936,19,19,1942,19,19,1948,19,71,19,1950,19,19,1953,19,19,1955,19,19,1963,19,19,1971,19,19,1978,19,19,1983,19,19,1989,19,19,1992,19,19,1998,19,19,2005,19,19,2011,19,19,2019,19],{"id":22,"style":368},[25,1879,1880],{"style":27},[29,1881,1882],{"style":410},"\u002F* updateprogress css *\u002F",[25,1884,1885],{"style":40},"    #OuterTableCellOverlay",[25,1887,1888],{"style":27},"    {",[25,1890,874,1891,1894,1895,1463],{"style":40},[29,1892,1893],{"style":373},"background-color",": ",[29,1896,1897],{"style":388},"white;",[25,1899,1900],{"style":27},"        filter:alpha(opacity=85);",[25,1902,1903,1904,874],{"style":40},"        -moz-opacity:",[29,1905,1906],{"style":388},"0.85;",[25,1908,1909,1910],{"style":27},"        z-index: ",[29,1911,1912],{"style":388},"999;",[25,1914,874,1915,1894,1918],{"style":40},[29,1916,1917],{"style":373},"width",[29,1919,1920],{"style":388},"100%;",[25,1922,874,1923,1894,1926],{"style":27},[29,1924,1925],{"style":373},"height",[29,1927,1920],{"style":388},[25,1929,874,1930,1894,1933],{"style":40},[29,1931,1932],{"style":373},"position",[29,1934,1935],{"style":388},"absolute;",[25,1937,874,1938,1941],{"style":27},[29,1939,1940],{"style":373},"top",": 0;",[25,1943,874,1944,1947],{"style":40},[29,1945,1946],{"style":373},"left",": 0;                        ",[25,1949,538],{"style":27},[25,1951,1952],{"style":27},"    #InnerTableCellOverlay",[25,1954,1888],{"style":40},[25,1956,874,1957,1894,1960],{"style":27},[29,1958,1959],{"style":373},"border",[29,1961,1962],{"style":388},"1px solid black;",[25,1964,874,1965,1894,1968],{"style":40},[29,1966,1967],{"style":373},"padding",[29,1969,1970],{"style":388},"10px;",[25,1972,874,1973,1894,1975],{"style":27},[29,1974,1893],{"style":373},[29,1976,1977],{"style":388},"#eee;",[25,1979,1909,1980],{"style":40},[29,1981,1982],{"style":388},"998;",[25,1984,874,1985,1894,1987],{"style":27},[29,1986,1893],{"style":373},[29,1988,1977],{"style":388},[25,1990,1991],{"style":40},"        filter:alpha(opacity=100);",[25,1993,874,1994,1894,1996],{"style":27},[29,1995,1932],{"style":373},[29,1997,1935],{"style":388},[25,1999,874,2000,1894,2002],{"style":40},[29,2001,1940],{"style":373},[29,2003,2004],{"style":388},"0pt;",[25,2006,874,2007,1894,2009,924],{"style":27},[29,2008,1946],{"style":373},[29,2010,2004],{"style":388},[25,2012,874,2013,1894,2016,874],{"style":40},[29,2014,2015],{"style":373},"text-align",[29,2017,2018],{"style":388},"center;",[25,2020,538],{"style":27},[16,2022,41],{"id":18},[16,2024,19,2025,19],{"id":18},[16,2026,19,2027,19,19,2054,19,19,2068,19],{"id":22,"style":368},[25,2028,2029,2031,71,2034,2036,71,2038,2040,71,2042,2045,71,2048,2051,71],{"style":27},[29,2030,1381],{"style":373},[29,2032,2033],{"style":1384},"asp:Button",[29,2035,1426],{"style":1388},[29,2037,1520],{"style":373},[29,2039,1411],{"style":1388},[29,2041,1414],{"style":373},[29,2043,2044],{"style":1388},"CssClass",[29,2046,2047],{"style":373},"=\"btn\"",[29,2049,2050],{"style":1388},"style",[29,2052,2053],{"style":373},"=\"width:100px;\"",[25,2055,1490,2056,2059,71,2062,2065,71],{"style":40},[29,2057,2058],{"style":1388},"OnClientClick",[29,2060,2061],{"style":373},"=\"return fncValidateSubmit('Ready to Submit?');\"",[29,2063,2064],{"style":1388},"Text",[29,2066,2067],{"style":373},"=\"Save\"",[25,2069,1490,2070,2073,71,2075,2078,71,2081],{"style":27},[29,2071,2072],{"style":1388},"ToolTip",[29,2074,2067],{"style":373},[29,2076,2077],{"style":1388},"Visible",[29,2079,2080],{"style":373},"=\"false\"",[29,2082,1523],{"style":373},[16,2084,41],{},[16,2086,41],{},[16,2088,19,2089,19],{"id":18},[16,2090,19,2092,19,19,2097,19,19,2103,19,19,2108,19,19,2116,19,19,2122,19,19,2127,19,19,2133,19,19,2138,19,71,19,2140,19,19,2145,19,19,2148,19,19,2154,19,19,2156,19],{"id":22,"style":2091},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 239px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,2093,2094],{"style":27},[29,2095,2096],{"style":410},"\u002F\u002Fvalidate before submitting signature authority            ",[25,2098,407,2099,2102],{"style":40},[29,2100,2101],{"style":373},"function"," fncValidateSubmit(msg) {",[25,2104,874,2105],{"style":27},[29,2106,2107],{"style":410},"\u002F\u002Fperform some client side validation checks here...",[25,2109,874,2110,2112,2113,2115],{"style":40},[29,2111,971],{"style":373}," (valid == ",[29,2114,1044],{"style":373},") {",[25,2117,924,2118,2121],{"style":27},[29,2119,2120],{"style":373},"var"," answer = confirm(msg);                    ",[25,2123,924,2124,2126],{"style":40},[29,2125,971],{"style":373}," (answer) {",[25,2128,2129,2130,402],{"style":27},"                ShowWait(",[29,2131,2132],{"style":388},"'UpdateProgress1'",[25,2134,1157,2135,2137],{"style":40},[29,2136,543],{"style":373}," answer;",[25,2139,935],{"style":27},[25,2141,1175,2142,513],{"style":27},[29,2143,2144],{"style":373},"else",[25,2146,2147],{"style":40},"            alert(errmsg);",[25,2149,924,2150,71,2152,390],{"style":27},[29,2151,543],{"style":373},[29,2153,401],{"style":373},[25,2155,908],{"style":40},[25,2157,538],{"style":27},[16,2159,19,2160,19],{"id":18},[16,2161,19,2163,19,19,2168,19,19,2171,19,19,2177,19],{"id":22,"style":2162},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 64px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,2164,2165,2167],{"style":27},[29,2166,2101],{"style":373}," ShowWait(progressControlId) {",[25,2169,2170],{"style":40},"    SetWaitDimensions();",[25,2172,2173,2174,390],{"style":27},"    document.getElementById(progressControlId).style.display = ",[29,2175,2176],{"style":388},"'block'",[25,2178,473],{"style":40},[1344,2180,2181],{},"This was an problem.",[16,2183,19,2185,19],{"id":18,"style":2184},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 204px; max-height: 500px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[16,2186,19,2187,19,19,2201,19,19,2204,19,19,2207,19,19,2210,19,19,2213,19,19,2216,19,19,2219,19,19,2222,19,19,2225,19,19,2228,19,19,2231,19],{"id":22,"style":368},[25,2188,2189,2190,2192,71,2194,2196,2199],{"style":27},"\u002F\u002F\u002F\u002Fcall the following from ",[29,2191,1381],{"style":373},[29,2193,1385],{"style":1384},[29,2195,1389],{"style":1388},[29,2197,2198],{"style":373},"=\"load()\"",[29,2200,1395],{"style":373},[25,2202,2203],{"style":40},"\u002F\u002F\u002F\u002Frequired so that background blur is dimensioned correctly (with respect to scroll issues with browser)",[25,2205,2206],{"style":27},"\u002F\u002F\u002F\u002Fenable js to be called after ajax postback",[25,2208,2209],{"style":40},"function loadAjaxHandlers() {",[25,2211,2212],{"style":27},"    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);",[25,2214,2215],{"style":40},"    \u002F\u002Fwill process during the initialization of the postback",[25,2217,2218],{"style":27},"    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(",[25,2220,2221],{"style":40},"                    function() {",[25,2223,2224],{"style":27},"                        SetWaitDimensions();",[25,2226,2227],{"style":40},"                    }",[25,2229,2230],{"style":27},"               )",[25,2232,473],{"style":40},[12,2234,2235],{},"The following is my complete Wait.js file which you can see sizes the overlay and positions the wait message.",[16,2237,19,2238,19],{"id":18,"style":813},[16,2239,19,2240,19,19,2245,19,19,2249,19,19,2253,19,19,2258,19,19,2260,19,19,2265,19,19,2267,19,19,2272,19,19,2274,19,19,2276,19,19,2278,19,19,2280,19,19,2282,19,19,2286,19,19,2288,19,19,2292,19,19,2294,19,19,2296,19,19,2301,19,19,2306,19,19,2311,19,19,2319,19,19,2327,19,19,2329,19,19,2335,19,19,2341,19,19,2343,19,19,2348,19,19,2353,19,19,2358,19,19,2360,19,19,2365,19,19,2371,19,19,2375,19,19,2380,19,19,2386,19,19,2388,19,19,2393,19,19,2398,19,19,2400,19,19,2410,19,19,2419,19,19,2421,19,19,2423,19,19,2425,19,19,2430,19,19,2435,19,19,2440,19,19,2445,19,19,2448,19,19,2451,19,19,2458,19,19,2461,19,19,2464,19,19,2468,19,19,2471,19,19,2474,19,19,2476,19,19,2481,19,19,2483,19,19,2485,19,19,2490,19,19,2495,19,19,2500,19,19,2503,19,19,2506,19,19,2511,19,19,2513,19,19,2515,19,19,2520,19,19,2525,19,19,2530,19,19,2533,19,19,2536,19,19,2541,19],{"id":22,"style":368},[25,2241,2242],{"style":27},[29,2243,2244],{"style":410},"\u002F\u002F\u002F\u002Fcall the following from \u003Cbody onload=\"load()\">",[25,2246,2247],{"style":40},[29,2248,2203],{"style":410},[25,2250,2251],{"style":27},[29,2252,2206],{"style":410},[25,2254,2255,2257],{"style":40},[29,2256,2101],{"style":373}," loadAjaxHandlers() {",[25,2259,2212],{"style":27},[25,2261,407,2262],{"style":40},[29,2263,2264],{"style":410},"\u002F\u002Fwill process during the initialization of the postback",[25,2266,2218],{"style":27},[25,2268,1540,2269,2271],{"style":40},[29,2270,2101],{"style":373},"() {",[25,2273,2224],{"style":27},[25,2275,2227],{"style":40},[25,2277,2230],{"style":27},[25,2279,473],{"style":40},[25,2281,41],{"style":27},[25,2283,2284,2167],{"style":40},[29,2285,2101],{"style":373},[25,2287,2170],{"style":27},[25,2289,2173,2290,390],{"style":40},[29,2291,2176],{"style":388},[25,2293,473],{"style":27},[25,2295,41],{"style":40},[25,2297,2298],{"style":27},[29,2299,2300],{"style":410},"\u002F\u002Fset dimensions of blur element, positions progress box",[25,2302,2303,2305],{"style":40},[29,2304,2101],{"style":373}," SetWaitDimensions() {",[25,2307,407,2308,2310],{"style":27},[29,2309,971],{"style":373}," (document.getElementById) {",[25,2312,874,2313,2315,2316,402],{"style":40},[29,2314,2120],{"style":373}," blur = document.getElementById(",[29,2317,2318],{"style":388},"'OuterTableCellOverlay'",[25,2320,874,2321,2323,2324,402],{"style":27},[29,2322,2120],{"style":373}," progress = document.getElementById(",[29,2325,2326],{"style":388},"'InnerTableCellOverlay'",[25,2328,41],{"style":40},[25,2330,2331,2332,390],{"style":27},"        progress.style.width = ",[29,2333,2334],{"style":388},"'444px'",[25,2336,2337,2338,390],{"style":40},"        progress.style.height = ",[29,2339,2340],{"style":388},"'100px'",[25,2342,41],{"style":27},[25,2344,874,2345,2347],{"style":40},[29,2346,2120],{"style":373}," vp = getViewport();",[25,2349,874,2350,2352],{"style":27},[29,2351,2120],{"style":373}," dm = getElementDimensions(document.body);",[25,2354,874,2355,2357],{"style":40},[29,2356,2120],{"style":373}," sp = getScrollPosition();",[25,2359,41],{"style":27},[25,2361,874,2362,2364],{"style":40},[29,2363,971],{"style":373}," (vp.height > dm.height)",[25,2366,2367,2368,390],{"style":27},"            blur.style.height = vp.height + ",[29,2369,2370],{"style":388},"'px'",[25,2372,874,2373],{"style":40},[29,2374,2144],{"style":373},[25,2376,2377,2378,390],{"style":27},"            blur.style.height = dm.height + ",[29,2379,2370],{"style":388},[25,2381,2382,2383,390],{"style":40},"        blur.style.width = ",[29,2384,2385],{"style":388},"'100%'",[25,2387,41],{"style":27},[25,2389,2390,2391,390],{"style":40},"        blur.style.top = (sp.y + ((vp.height - dm.height) \u002F 3)) + ",[29,2392,2370],{"style":388},[25,2394,2395,2396,390],{"style":27},"        blur.style.left = (sp.x + ((vp.width - dm.width) \u002F 2)) + ",[29,2397,2370],{"style":388},[25,2399,41],{"style":40},[25,2401,2402,2403,56,2405,2407,2408,390],{"style":27},"        progress.style.top = document.documentElement.clientHeight \u002F 3 - progress.style.height.replace(",[29,2404,2370],{"style":388},[29,2406,59],{"style":388},") \u002F 2 + ",[29,2409,2370],{"style":388},[25,2411,2412,2413,56,2415,2407,2417,390],{"style":40},"        progress.style.left = document.body.offsetWidth \u002F 2 - progress.style.width.replace(",[29,2414,2370],{"style":388},[29,2416,59],{"style":388},[29,2418,2370],{"style":388},[25,2420,41],{"style":27},[25,2422,538],{"style":40},[25,2424,473],{"style":27},[25,2426,2427],{"style":40},[29,2428,2429],{"style":410},"\u002F\u002Freturns view port dimensions",[25,2431,2432,2434],{"style":27},[29,2433,2101],{"style":373}," getViewport() {",[25,2436,407,2437,2439],{"style":40},[29,2438,2120],{"style":373}," v = { width: 0, height: 0 };",[25,2441,407,2442,2444],{"style":27},[29,2443,971],{"style":373}," (window.innerHeight) {",[25,2446,2447],{"style":40},"        v.height = window.innerHeight;",[25,2449,2450],{"style":27},"        v.width = window.innerWidth;",[25,2452,528,2453,71,2455,2457],{"style":40},[29,2454,2144],{"style":373},[29,2456,971],{"style":373}," (document.documentElement.clientHeight) {",[25,2459,2460],{"style":27},"        v.height = document.documentElement.clientHeight;",[25,2462,2463],{"style":40},"        v.width = document.documentElement.clientWidth;",[25,2465,528,2466,513],{"style":27},[29,2467,2144],{"style":373},[25,2469,2470],{"style":40},"        v.height = document.body.clientHeight;",[25,2472,2473],{"style":27},"        v.width = document.body.clientWidth;",[25,2475,538],{"style":40},[25,2477,407,2478,2480],{"style":27},[29,2479,543],{"style":373}," v;",[25,2482,473],{"style":40},[25,2484,41],{"style":27},[25,2486,2487],{"style":40},[29,2488,2489],{"style":410},"\u002F\u002Freturns dimensions of element",[25,2491,2492,2494],{"style":27},[29,2493,2101],{"style":373}," getElementDimensions(el) {",[25,2496,407,2497,2499],{"style":40},[29,2498,2120],{"style":373}," dim = { width: 0, height: 0 };",[25,2501,2502],{"style":27},"    dim.width = el.offsetWidth;",[25,2504,2505],{"style":40},"    dim.height = el.offsetHeight;",[25,2507,407,2508,2510],{"style":27},[29,2509,543],{"style":373}," dim;",[25,2512,473],{"style":40},[25,2514,41],{"style":27},[25,2516,2517],{"style":40},[29,2518,2519],{"style":410},"\u002F\u002Freturns window scroll position",[25,2521,2522,2524],{"style":27},[29,2523,2101],{"style":373}," getScrollPosition() {",[25,2526,407,2527,2529],{"style":40},[29,2528,2120],{"style":373}," pos = { x: 0, y: 0 };",[25,2531,2532],{"style":27},"    pos.x = window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft;",[25,2534,2535],{"style":40},"    pos.y = window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop;",[25,2537,407,2538,2540],{"style":27},[29,2539,543],{"style":373}," pos;",[25,2542,473],{"style":40},[301,2544],{"style":1324,"src":2545,"alt":304},"\u002Farticles\u002Fimages\u002Fpanel.jpg",{"title":304,"searchDepth":307,"depth":307,"links":2547},[],"2015-04-20T08:07:16.0300000-04:00",null,{},"\u002Farticles\u002Fasp-net-updatepanel-updateprogress-controls-and-overlays-wait-messages",{"title":1338,"description":2549},"articles\u002Fasp-net-updatepanel-updateprogress-controls-and-overlays-wait-messages",[2555],"aspnet","0Cy_xmk1pTHqsntDFTdovnbYtmnSiOumdscBNMxpfJ4",1781574767753]