Advertisement
Advertisement
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902: 903: |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SearchSite.aspx.cs" Inherits="SearchSite" Title="Web Site Adminstration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<link rel="stylesheet" href="BandOSF.css" type="text/css">
</head>
<body>
<form id="form2" runat="server" defaultbutton="ButtonGo">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td class="headerAreaLogo" style="width: 15%; height: 92px;">
<a href="http://econnect.osfhealthcare.org/info/IS/Pages/default.aspx">
<img src="images/spacer.gif" height="85" alt="eConnect"
onclick="http://econnect.osfhealthcare.org/info/IS/Pages/default.aspx" style="border:None" width="179">
</a>
</td>
<td class="headerAreaBanner" style="width: 85%; height: 92px;">
</td>
</tr>
</table>
</div>
<br />
<asp:Panel ID="PanelTopLevel" runat="server" Height="1px" Width="718px">
<asp:Label ID="Label1" runat="server" Text="Search for OSF Web Site: " Width="173px" Font-Bold="True" CssClass="standard-text"></asp:Label>
<asp:TextBox ID="TextBoxWebSearch" runat="server" Width="299px" ToolTip='Search criteria examples: "Patient Safety", "Cardiology ", "ICU", "Human Resources"' CssClass="standard-text"></asp:TextBox>
<asp:Button ID="ButtonGo" runat="server" Font-Bold="True" OnClick="ButtonGo_Click"
Text="GO!" CssClass="standard-text" />
<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Underline="True" Text="Using Search"
Width="167px"></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="In order to find the OSF web site you are searching for; you can simply enter keywords that can be found in the OSF Web Title, Web Address or Description."
Width="523px" CssClass="standard-text"></asp:Label><div id="DIV1">
</div>
</asp:Panel>
<script language="javascript" type="text/javascript">
function expandcollapse(obj,row)
{
var div = document.getElementById(obj);
var img = document.getElementById('img' + obj);
if (div.style.display == "none")
{
div.style.display = "block";
if (row == 'alt')
{
img.src = "minus.gif";
}
else
{
img.src = "minus.gif";
}
img.alt = "Close to view other Customers";
}
else
{
div.style.display = "none";
if (row == 'alt')
{
img.src = "plus.gif";
}
else
{
img.src = "plus.gif";
}
img.alt = "Expand to show Orders";
}
}
</script>
<asp:GridView ID="GridView1" AllowPaging="True" DataSourceID="SqlDataSource1"
style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 248px" ShowFooter="True" Font-Size="Small"
Font-Names="Verdana" runat="server" GridLines="None" OnRowDataBound="GridView1_RowDataBound"
OnRowCommand = "GridView1_RowCommand" OnRowUpdating = "GridView1_RowUpdating"
OnRowDeleting = "GridView1_RowDeleting" OnRowDeleted = "GridView1_RowDeleted"
OnRowUpdated = "GridView1_RowUpdated" AllowSorting="True" Height="319px" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<HeaderStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True"/>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="SiteID" InsertVisible="False" SortExpression="SiteID"
Visible="False">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"SiteID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"SiteID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<a href="javascript:expandcollapse('div<%# Eval("SiteID") %>', 'one');">
<img id="imgdiv<%# Eval("URL") %>" alt="Click to show/hide Address for SAS's <%# Eval("URL") %>" width="9px" border="0" src="plus.gif"/>
</a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="URL" SortExpression="URL">
<ItemTemplate>
<asp:Label ID="lblURL" Text='<%# Eval("URL") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblURL" Text='<%# Eval("URL") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtURL" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Environment" SortExpression="Environment">
<ItemTemplate>
<asp:Label ID="lblEnvironment" Text='<%# Eval("Environment") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblEnvironment" Text='<%# Eval("Environment") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtEnvironment" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:Label ID="lblTitle" Text='<%# Eval("Title") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblTitle" Text='<%# Eval("Title") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtTitle" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<ItemTemplate>
<asp:Label ID="lblDescription" Text='<%# Eval("Description") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblDescription" Text='<%# Eval("Description") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtDescription" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Contact" SortExpression="Contact">
<ItemTemplate>
<asp:Label ID="lblContact" Text='<%# Eval("Contact") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblContact" Text='<%# Eval("Contact") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtContact" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PublicAvail" SortExpression="PublicAvail">
<ItemTemplate>
<asp:Label ID="lblPublicAvail" Text='<%# Eval("PublicAvail") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblPublicAvail" Text='<%# Eval("PublicAvail") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPublicAvail" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FacAcronym" SortExpression="FacAcronym">
<ItemTemplate>
<asp:Label ID="lblFacAcronym" Text='<%# Eval("FacAcronym") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblFacAcronym" Text='<%# Eval("FacAcronym") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtFacAcronym" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="Category">
<ItemTemplate>
<asp:Label ID="lblCategory" Text='<%# Eval("Category") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblCategory" Text='<%# Eval("Category") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtCategory" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SASPerson" SortExpression="SASPerson">
<ItemTemplate>
<asp:Label ID="lblSASPerson" Text='<%# Eval("SASPerson") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblSASPerson" Text='<%# Eval("SASPerson") %>' runat="server"></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSASPerson" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="linkDeleteCust" CommandName="Delete" runat="server">Delete</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="linkAddCust" CommandName="AddCustomer" runat="server">Add</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<tr>
<td>
<div id="div<%# Eval("SiteID") %>" style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:97%" >
<asp:GridView ID="GridView2" AllowPaging="true" AllowSorting="true" BackColor="White" Width="100%" Font-Size="X-Small"
AutoGenerateColumns="false" Font-Names="Verdana" runat="server" DataKeyNames="SiteID" ShowFooter="true"
OnPageIndexChanging="GridView2_PageIndexChanging" OnRowUpdating = "GridView2_RowUpdating"
OnRowCommand = "GridView2_RowCommand" OnRowEditing = "GridView2_RowEditing" GridLines="None"
OnRowUpdated = "GridView2_RowUpdated" OnRowCancelingEdit = "GridView2_CancelingEdit" OnRowDataBound = "GridView2_RowDataBound"
OnRowDeleting = "GridView2_RowDeleting" OnRowDeleted = "GridView2_RowDeleted" OnSorting = "GridView2_Sorting"
BorderStyle="Double" BorderColor="#0083C1">
<RowStyle BackColor="Gainsboro" />
<AlternatingRowStyle BackColor="White" />
<HeaderStyle BackColor="#0083C1" ForeColor="White"/>
<FooterStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="SiteID" SortExpression="SiteID">
<ItemTemplate>
<asp:Label ID="lblSiteID" Text='<%# DataBinder.Eval(Container.DataItem,"SiteID") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblSiteID" Text='<%# DataBinder.Eval(Container.DataItem,"SiteID") %>' runat="server"></asp:Label>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ServerID" SortExpression="ServerID">
<ItemTemplate><%# Eval("ServerID")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtServerID" Text='<%# Eval("ServerID")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtServerID" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Port" SortExpression="Port">
<ItemTemplate><%# Eval("Port")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtPort" Text='<%# Eval("Port")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPort" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IP" SortExpression="IP">
<ItemTemplate><%# Eval("IP")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtIP" Text='<%# Eval("IP")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtIP" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="HardWareFarm" SortExpression="HardWareFarm">
<ItemTemplate><%# Eval("HardWareFarm")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtHardWareFarm" Text='<%# Eval("HardWareFarm")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtHardWareFarm" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SSL" SortExpression="SSL">
<ItemTemplate><%# Eval("SSL")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtSSL" Text='<%# Eval("SSL")%>' runat="server"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSSL" Text='' runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="linkDeleteCust" CommandName="Delete" runat="server">Delete</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="linkAddOrder" CommandName="AddOrder" runat="server">Add</asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:OSFWebSiteListingConnectionString %>"
SelectCommand="WebSite_GetWebSiteAdmin" SelectCommandType="StoredProcedure" >
<SelectParameters>
<asp:SessionParameter DefaultValue="""" Name="Name" SessionField="SelectText"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:OSFWebSiteListingConnectionString %>"
SelectCommand="WebSite_GetHardWareAdmin" SelectCommandType="StoredProcedure" >
<SelectParameters>
<asp:SessionParameter DefaultValue="""" Name="Name" SessionField="SelectHardWare"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
C# Part:
---------------------------------------------------------
//' Kim Minarik GridView with Children to update HardWareInfo and WebSites
//' ---------------------------------------------------------
//'=======================================================
//' FileName : AddressNested.aspx
//' Description : Multi Purpose GridView, Which can be expandable to many child grids
//' Reason : The change for this was due to the fact that the users needed the
//' : added functionality to be able to pull a record from a parent table
//' : and be able to see the record in grid format from another table.
//' Date of Creation : April, 2008
//' Author : Kimberly Minarik
//'=======================================================
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;
using WebSite.DataAccessLayer;
using System.Web.Configuration;
using WebSite.BusinessLogicLayer;
public partial class SearchSite : System.Web.UI.Page
{
#region Variables
string gvUniqueID = String.Empty;
int gvNewPageIndex = 0;
int gvEditIndex = -1;
string gvSortExpr = String.Empty;
private string gvSortDir
{
get { return ViewState["SortDirection"] as string ?? "ASC"; }
set { ViewState["SortDirection"] = value; }
}
#endregion
//This procedure returns the Sort Direction
private string GetSortDirection()
{
switch (gvSortDir)
{
case "ASC":
gvSortDir = "DESC";
break;
case "DESC":
gvSortDir = "ASC";
break;
}
return gvSortDir;
}
//This procedure prepares the query to bind the child GridView
//public SqlDataSource ChildDataSource(string strSiteID)
//{
//SqlCommand com = new SqlCommand("WebSite_GetHardWareAdmin" + strSiteID, conn);
//com.CommandType = System.Data.CommandType.StoredProcedure;
//SqlDataAdapter da = new SqlDataAdapter(com);
//DataSet ds = new DataSet();
//da.Fill(ds);
//DataSet dsData = SqlHelper.ExecuteDataset(WebConfigurationManager.ConnectionStrings["OSFWebSiteListingConnectionString"].ConnectionString,
// "WebSite_GetHardWareAdmin", strSiteID);
//SqlDataSource ds = new SqlDataSource();
//ds.DataBinding(dsData);
//ds.Fill(dsData);
//SqlDataAdapter da = new SqlDataAdapter(ds);
//DataSet dset = new DataSet();
//DataTable dataTable = dsData.Tables[0];
//if (dataTable.Rows.Count != 0)
//{
// DataRow row = dataTable.Rows[0];
// string strServerID = (string)row["ServerID"];
// string strPort = (string)row["Port"];
// string strIP = (string)row["IP"];
// string strHardWareFarm = (string)row["HardWareFarm"];
// string strSSL = (string)row["SSL"];
//}
//return ds;
// }
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
}
else
{
this.TextBoxWebSearch.Focus();
Session["SearchText"] = this.TextBoxWebSearch.Text;
//BindChildGrid();
}
}
#region GridView1 Event Handlers
//This event occurs for each row
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
string strSort = string.Empty;
// Make sure we aren't in header/footer rows
if (row.DataItem == null)
{
return;
}
//Find Child GridView control
GridView gv = new GridView();
gv = (GridView)row.FindControl("GridView2");
//KMM addded code here to get ID>
//GridView gvTemp = (GridView)sender;
//gvUniqueID = gvTemp.UniqueID;
//Check if any additional conditions (Paging, Sorting, Editing, etc) to be applied on child GridView
if (gv.UniqueID == gvUniqueID)
{
gv.PageIndex = gvNewPageIndex;
gv.EditIndex = gvEditIndex;
//Check if Sorting used
gvSortExpr = "ASC";
if (gvSortExpr != string.Empty)
{
//GetSortDirection();
//strSort = " ORDER BY " + string.Format("{0} {1}", gvSortExpr, gvSortDir);
}
//Expand the Child grid
ClientScript.RegisterStartupScript(GetType(), "Expand", "<SCRIPT LANGUAGE='javascript'>expandcollapse('div" + ((DataRowView)e.Row.DataItem)["SiteID"].ToString() + "','one');</script>");
}
//Prepare the query for Child GridView by passing the Site ID of the parent row
//gv.DataSource = ChildDataSource(((DataRowView)e.Row.DataItem)["SiteID"].ToString());
// gv.DataBind();
//Add delete confirmation message for Customer
LinkButton l = (LinkButton)e.Row.FindControl("linkDeleteCust");
l.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete this Address " +
DataBinder.Eval(e.Row.DataItem, "SiteID") + "')");
}
//This event occurs for any operation on the row of the grid
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
//Check if Add button clicked
if (e.CommandName == "AddCustomer")
{
try
{
//Get the values stored in the text boxes
string strURL = ((TextBox)GridView1.FooterRow.FindControl("txtURL")).Text;
string strEnvironment = ((TextBox)GridView1.FooterRow.FindControl("txtEnvironment")).Text;
string strTitle = ((TextBox)GridView1.FooterRow.FindControl("txtTitle")).Text;
string strDescription = ((TextBox)GridView1.FooterRow.FindControl("txtDescription")).Text;
string strContact = ((TextBox)GridView1.FooterRow.FindControl("txtContact")).Text;
//wse.UpdateWebSiteEntry();
//Prepare the Insert Command of the DataSource control
////string strSQL = "";
////strSQL = "INSERT INTO Customers (CustomerID, CompanyName, ContactName, " +
//// "ContactTitle, Address) VALUES ('" + strCustomerID + "','" + strCompanyName + "','" +
//// strContactName + "','" + strContactTitle + "','" + strAddress + "')";
////AccessDataSource1.InsertCommand = strSQL;
////AccessDataSource1.Insert();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('Address added successfully');</script>");
//Re bind the grid to refresh the data
GridView1.DataBind();
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + ex.Message.ToString().Replace("'", "") + "');</script>");
}
}
}
//This event occurs on click of the Update button
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//Get the values stored in the text boxes
string strURL = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtURL")).Text;
string strEnvironment = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtEnvironment")).Text;
string strTitle = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTitle")).Text;
string strDescription = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDescription")).Text;
string strContact = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblContact")).Text;
try
{
//Prepare the Update Command of the DataSource control
// wse.UpdateWebSiteEntry();
////string strSQL = "";
////strSQL = "UPDATE Customers set CompanyName = '" + strCompanyName + "'" +
//// ",ContactName = '" + strContactName + "'" +
//// ",ContactTitle = '" + strContactTitle + "'" +
//// ",Address = '" + strAddress + "'" +
//// " WHERE CustomerID = '" + strCustomerID + "'";
////AccessDataSource1.UpdateCommand = strSQL;
////AccessDataSource1.Update();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('Address updated successfully');</script>");
}
catch { }
}
//This event occurs after RowUpdating to catch any constraints while updating
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
//Check if there is any exception while deleting
if (e.Exception != null)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + e.Exception.Message.ToString().Replace("'", "") + "');</script>");
e.ExceptionHandled = true;
}
}
//This event occurs on click of the Delete button
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//Get the value
string strSiteID = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblSiteID")).Text;
//Prepare the delete Command of the DataSource control
string strSQL = "";
try
{
//strSQL = "DELETE from Customers WHERE CustomerID = '" + strCustomerID + "'";
//AccessDataSource1.DeleteCommand = strSQL;
//AccessDataSource1.Delete();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('Customer deleted successfully');</script>");
}
catch { }
}
//This event occurs after RowDeleting to catch any constraints while deleting
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
//Check if there is any exception while deleting
if (e.Exception != null)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + e.Exception.Message.ToString().Replace("'", "") + "');</script>");
e.ExceptionHandled = true;
}
}
#endregion
#region GridView2 Event Handlers
protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
gvNewPageIndex = e.NewPageIndex;
GridView1.DataBind();
}
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "AddOrder")
{
try
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
//Get the values stored in the text boxes
string strSiteID = gvTemp.DataKeys[0].Value.ToString(); //Customer ID is stored as DataKeyNames
string strServerID = ((TextBox)gvTemp.FooterRow.FindControl("txtServerID")).Text;
string strPort = ((TextBox)gvTemp.FooterRow.FindControl("txtPort")).Text;
string strIP = ((TextBox)gvTemp.FooterRow.FindControl("txtIP")).Text;
string strHardWareFarm = ((TextBox)gvTemp.FooterRow.FindControl("txtHardWareFarm")).Text;
string strSSL = ((TextBox)gvTemp.FooterRow.FindControl("txtSSL")).Text;
//Prepare the Insert Command of the DataSource control
////string strSQL = "";
////strSQL = "INSERT INTO Orders (CustomerID, Freight, ShipName, " +
//// "ShipAddress) VALUES ('" + strCustomerID + "'," + float.Parse(strFreight) + ",'" +
//// strShipperName + "','" + strShipAdress + "')";
////AccessDataSource1.InsertCommand = strSQL;
////AccessDataSource1.Insert();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('Order added successfully');</script>");
GridView1.DataBind();
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + ex.Message.ToString().Replace("'", "") + "');</script>");
}
}
}
protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
gvEditIndex = e.NewEditIndex;
GridView1.DataBind();
}
protected void GridView2_CancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
gvEditIndex = -1;
GridView1.DataBind();
}
protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
//Get the values stored in the text boxes
string strSiteID = ((Label)gvTemp.Rows[e.RowIndex].FindControl("lblSiteID")).Text;
string strServerID = ((TextBox)gvTemp.Rows[e.RowIndex].FindControl("txtServerID")).Text;
string strPort = ((TextBox)gvTemp.Rows[e.RowIndex].FindControl("txtPort")).Text;
string strIP = ((TextBox)gvTemp.Rows[e.RowIndex].FindControl("txtIP")).Text;
string strHardWareFarm = ((TextBox)gvTemp.Rows[e.RowIndex].FindControl("txtHardWareFarm")).Text;
string strSSL = ((TextBox)gvTemp.Rows[e.RowIndex].FindControl("txtSSL")).Text;
//Prepare the Update Command of the DataSource control
//AccessDataSource dsTemp = new AccessDataSource();
//dsTemp.DataFile = "App_Data/Northwind.mdb";
//string strSQL = "";
//strSQL = "UPDATE Orders set Freight = " + float.Parse(strFreight) + "" +
// ",ShipName = '" + strShipperName + "'" +
// ",ShipAddress = '" + strShipAdress + "'" +
// " WHERE OrderID = " + strOrderID;
//dsTemp.UpdateCommand = strSQL;
//dsTemp.Update();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('HardWare updated successfully');</script>");
//Reset Edit Index
gvEditIndex = -1;
GridView1.DataBind();
}
catch { }
}
protected void GridView2_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
//Check if there is any exception while deleting
if (e.Exception != null)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + e.Exception.Message.ToString().Replace("'", "") + "');</script>");
e.ExceptionHandled = true;
}
}
protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
//Get the value
string strSiteID = ((Label)gvTemp.Rows[e.RowIndex].FindControl("lblSiteID")).Text;
//Prepare the Update Command of the DataSource control
string strSQL = "";
try
{
//strSQL = "DELETE from Orders WHERE OrderID = " + strOrderID;
//AccessDataSource dsTemp = new AccessDataSource();
//dsTemp.DataFile = "App_Data/Northwind.mdb";
//dsTemp.DeleteCommand = strSQL;
//dsTemp.Delete();
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('HardWare deleted successfully');</script>");
GridView1.DataBind();
}
catch { }
}
protected void GridView2_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
//Check if there is any exception while deleting
if (e.Exception != null)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + e.Exception.Message.ToString().Replace("'", "") + "');</script>");
e.ExceptionHandled = true;
}
}
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
//Check if this is our Blank Row being databound, if so make the row invisible
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (((DataRowView)e.Row.DataItem)["SiteID"].ToString() == String.Empty) e.Row.Visible = false;
}
}
protected void GridView2_Sorting(object sender, GridViewSortEventArgs e)
{
GridView gvTemp = (GridView)sender;
gvUniqueID = gvTemp.UniqueID;
gvSortExpr = e.SortExpression;
GridView1.DataBind();
}
#endregion
protected void ButtonGo_Click(object sender, EventArgs e)
{
Session["SelectText"] = this.TextBoxWebSearch.Text;
string Name = this.TextBoxWebSearch.Text;
Session["SelectText"] = Name;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["OSFWebSiteListingConnectionString"].ConnectionString);
conn.Open();
SqlCommand com = new SqlCommand("WebSite_GetWebSiteAdmin", conn);
com.CommandType = System.Data.CommandType.StoredProcedure;
//SqlDataAdapter da = new SqlDataAdapter(com);
//DataSet ds = new DataSet();
//da.Fill(ds);
com.Parameters.Add(new SqlParameter("@Name", System.Data.SqlDbType.VarChar, 100));
com.Parameters[0].Value = System.Web.HttpContext.Current.Session["SelectText"];
com.ExecuteNonQuery();
conn.Close();
// Now make the Gridview and Label Visible
GridView1.Visible = true;
//this.LabelGridViewTitle.Visible = true
GridView1.DataSource = SqlDataSource1;
GridView1.DataSourceID = "";
GridView1.DataBind();
}
//private void BindChildGrid()
//{
// for (int i = 0; i < MasterGrid.Rows.Count; i++)
// {
// ((GridView)GridView1.Rows[i].Cells[1].Controls[1]).DataSource = null;
// Label lbl1 = (Label)(MasterGrid.Rows[i].Cells[0].Controls[3]);
// DataSet ds1 = new DataSet();
// SqlCommand cmd =
// new SqlCommand(
// "SELECT Emp_no, Emp_name, Emp_sal FROM Emp_table where Emp_dept ='" +
// lbl1.Text + "'", con);
// SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText, con);
// da.Fill(ds1, "Emp_table");
// ((GridView)MasterGrid.Rows[i].Cells[1].Controls[1]).DataSource = ds1;
// ((GridView)MasterGrid.Rows[i].Cells[1].Controls[1]).AllowSorting = true;
// ((GridView)MasterGrid.Rows[i].Cells[1].Controls[1]).DataBind();
// }
//}
}
My SQL Stored Procedure for getting the data does the following
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[WebSite_GetWebSiteAdmin]
(
@Name varchar(50)
)
AS
SELECT
SiteID,
URL,
Environment,
Title,
Description,
Contact,
PublicAvail,
WebSites.FacID,
Facility.[FacAcronym],
WebSites.CatID,
Category.[Category],
WebSites.SASID,
SASPerson.[SASPerson]
FROM
(Websites INNER JOIN Facility ON (Facility.FacilityID = WebSites.FacID)
INNER JOIN Category ON (Category.CategoryID = WebSites.CatID) INNER JOIN
SASPerson ON (SASPerson.SASPersonID = SASID))
WHERE
Websites.SASID = SASPerson.SASPersonID AND
WebSites.FacID = Facility.FacilityID AND
WebSites.CatID = Category.CategoryID AND (
URL LIKE '%' + @Name + '%' OR
Title LIKE '%' + @Name + '%' OR
Description LIKE '%' + @Name + '%'
)
UNION ALL
Select
HardWareInfo.SiteID,
ServerID,
Port,
IP,
HardWareFarm,
SSL,
'',
'',
'',
'',
'',
'',
''
FROM HardWareInfo INNER JOIN WebSites ON (WebSites.SiteID = HardWareInfo.SiteID)
WHERE (
URL LIKE '%' + @Name + '%' OR
Title LIKE '%' + @Name + '%' OR
Description LIKE '%' + @Name + '%'
)
|