|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
In Over My Head with ASP
Hi. I have found myself in over my head and am looking for any help anyone can provide. I am working on a redesign for a client and they have a database connected to their website that users can use to search their inventory. Problem #1: I don't have any experience with asp and am in the process of learning php now. Problem #2: I am working on a Mac and the existing code is written in asp. Not sure if it has to be translated so that I can work with it on my Mac or not.
The client would like the search function added to several new pages of their website. It currently is only installed on one page. Problem #3: How do I install it on the new pages? Is it as simple as cut and paste? (I'm working in Dreamweaver CS3) I don't think so but I'm not sure. Help... I'm so confused and my deadline is Friday!! |
|
#2
|
||||
|
||||
|
Yes, you can just cut and paste the search box (it should be a form which is the same in any language). If there are include files in the page that currently contains the search box, you may want to include them in the other pages as well, just in case. they would look something like this
Code:
<!--#include file="file_name.asp"--> As for your other questions, as long as you're not testing your new code on your computer but uploading it to your client's server, it doesn't matter whether you're using a mac or a pc. It's just text until you put it on a server. |
|
#3
|
|||
|
|||
|
Thank you. I'll try cuttting and pasting the search box.
:-) Quote:
|
|
#4
|
||||
|
||||
|
If you have a problem, post the code here and we'll show you what you need to copy from the code to paste in the other pages.
|
|
#5
|
|||
|
|||
|
Here is the code...
Here's the code from the current page:
Code:
<%@ Page Language="C#" MasterPageFile="~/KRN2007.master" AutoEventWireup="true" CodeFile="inventory_search.aspx.cs" Inherits="inventory_search" Title="Inventory Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MiddleContent" Runat="Server">
<div class="content">
<img src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/partssearch_title_ani.gif" alt=""/>
<br />
<div class="content_inventory_search">
<h2>Parts Search</h2>
<table width="730" border="0" cellspacing="0" cellpadding="0" style="border-color: Red">
<tr align="left"><td colspan="3"> </td></tr>
<tr align="left" valign="top">
<td>
<table border="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td align="right"><b>Part #:</b></td>
<td> </td>
<td align="left">
<asp:TextBox ID="txtPartNumber" runat="server" /></td>
<td> </td>
<td align="left">
<asp:Button ID="btnPartSearch" Text="Search" runat="server" OnCommand="btnPartSearch_Click" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="right"><b>Description:</b></td>
<td> </td>
<td align="left">
<asp:TextBox ID="txtDescription" runat="server" /></td>
<td> </td>
<td align="left">
<asp:Button ID="btnDescSearch" Text="Search" runat="server" OnCommand="btnDescSearch_Click" /></td>
</tr>
</table>
</td>
<td> </td>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0">
<asp:Panel ID="pnlSearchResultInstruction" runat="server" Visible="false" >
<tr><td> </td></tr>
<tr>
<td>
Click on the "
<img src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/Plus.gif" border="0" width="11" height="11" /> " icon for more information<br />
ie. Condition, Cert Source and Alternate Part.
</td>
</tr>
</asp:Panel>
</table>
</td>
</tr>
<tr align="left">
<td colspan="3"> </td>
</tr>
<asp:Panel ID="pnlSearchResultSection" runat="server" Visible="false">
<tr align="left" valign="top">
<td colspan="3">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td style="line-height:20pt; color:#1515D0"><b>Search Results:</b></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<div runat="server" id="pnlSearchResultGrid" />
<div runat="server" id="pnlSearchResultGridNextPage">
<tr>
<td colspan="3" align="right" class="clsTableRowBottomRight">
<
<asp:LinkButton ID="btnPrevious10" runat="server" OnCommand="btnPrevious10_Click" Text="Previous 10" /> >
<
<asp:LinkButton ID="btnNext10" runat="server" OnCommand="btnNext10_Click" Text="Next 10" /> >
</td>
</tr>
</div>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="3" align="center" style="color:#1515D0; font-weight:bold">
For orders or price quotes: call (800) 366-6462 or (480) 753-0752 or
<br />email: <a href="mailto:websales@krn.com">websales@krn.com</a>
</td>
</tr>
<tr>
<td colspan="3"><br /><br /><br /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</asp:Panel>
</table>
</div>
<div class="inventory_search">
<img style="padding-right:10px; padding-top:0px;" src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/inventory_search.gif" border="0" align="left">
</div>
<div class="inventory_bullets">
<ul>
<li>CESSNA PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>PIPER PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>BEECHCRAFT PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>CESSNA CITATION: AIRFRAME PARTS</li>
<br /><br />
<li>LEARJET: AIRFRAME PARTS</li>
<br /><br />
<li>FAIRCHILD / METRO: AIRFRAME PARTS</li>
<br /><br />
<li>CONTINENTAL MOTORS: ENGINE & IGNITION PARTS</li>
<br /><br />
<li>TEXTRON LYCOMING: ENGINE PARTS</li>
<br /><br />
<li>PRATT & WHITNEY: ENGINE PARTS</li>
<br /><br />
<li>GARRETT / ALLIED SIGNAL: ENGINE PARTS, WASTEGATES, VALVES & CONTROLLERS</li>
<br /><br />
<li>CLEVELAND: BRAKES, WHEELS, AND DISCS</li>
<br /><br />
<li>DISTRIBUTORS OF: RAPCO, MCFARLANE, & PMA PRODUCTS</li>
</ul>
</div>
<div class="clearer"> </div>
</div>
</asp:Content>
There is also a css page, here is that code: Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.SqlClient;
using System.Text;
using System.Web.Configuration;
using System.IO;
public partial class inventory_search : System.Web.UI.Page
{
private const string DBCONNECTION = "KRN_DB_CONNECTION";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["Previous10"] = null;
ViewState["Next10"] = null;
ViewState["SearchByType"] = null;
ViewState["SearchByValue"] = null;
}
}
public void btnPrevious10_Click(Object sender, System.EventArgs e)
{
try
{
int seqID = Convert.ToInt32(ViewState["Previous10"]);
if (Convert.ToString(ViewState["SearchByType"]) != null)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
if (Convert.ToString(ViewState["SearchByType"]) == "BYNUMBER")
{
command.Parameters.AddWithValue("@partnumber", Convert.ToString(ViewState["SearchByValue"]));
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
}
else
{
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", Convert.ToString(ViewState["SearchByValue"]));
}
command.Parameters.AddWithValue("@startseq", seqID);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnNext10_Click(Object sender, System.EventArgs e)
{
try
{
int seqID = Convert.ToInt32(ViewState["Next10"]);
if (Convert.ToString(ViewState["SearchByType"]) != null)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
if (Convert.ToString(ViewState["SearchByType"]) == "BYNUMBER")
{
command.Parameters.AddWithValue("@partnumber", Convert.ToString(ViewState["SearchByValue"]));
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
}
else
{
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", Convert.ToString(ViewState["SearchByValue"]));
}
command.Parameters.AddWithValue("@startseq", seqID);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnDescSearch_Click(Object sender, System.EventArgs e)
{
try
{
if (txtDescription.Text.Trim() != string.Empty)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", txtDescription.Text.Trim());
command.Parameters.AddWithValue("@startseq", DBNull.Value);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
else
{
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
txtPartNumber.Text = "";
ViewState["SearchByType"] = "BYDESC";
ViewState["SearchByValue"] = txtDescription.Text.Trim();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnPartSearch_Click(object sender, System.EventArgs e)
{
try
{
if (txtPartNumber.Text.Trim() != string.Empty)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
command.Parameters.AddWithValue("@partnumber", txtPartNumber.Text.TrimEnd());
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
command.Parameters.AddWithValue("@startseq", DBNull.Value);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
else
{
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
txtDescription.Text = "";
ViewState["SearchByType"] = "BYNUMBER";
ViewState["SearchByValue"] = txtPartNumber.Text.TrimEnd();
}
}
catch (Exception ex)
{
throw (ex);
}
}
private string RenderSearchResultTable(DataSet dsResult)
{
string outputHTMLGrid = string.Empty;
try
{
//Start construct the HTML to emit.
StringBuilder sb = new StringBuilder();
System.Diagnostics.Debug.WriteLine(HttpUtility.Htm lEncode(">"));
if (dsResult.Tables[0].Rows.Count < 1)
{
pnlSearchResultGridNextPage.Visible = false;
pnlSearchResultInstruction.Visible = false;
sb.Append("<tr>");
sb.Append("<td colspan=\"3\" width=\"100%\" ><b><font color='RED'>No matches were found.</font></b></td>");
sb.Append("</tr>");
}
else
{
pnlSearchResultGridNextPage.Visible = true;
sb.Append("<tr>");
sb.Append("<td width=\"29%\" class=\"clsTableHeaderLeft\"><b>Part #</b></td>");
sb.Append("<td width=\"50%\" class=\"clsTableHeaderLeft\"><b>Description</b></td>");
sb.Append("<td width=\"21%\" class=\"clsTableHeaderRight\" align=\"center\" ><b>Available Quantity</b></td>");
sb.Append("</tr>");
foreach (DataRow r in dsResult.Tables[0].Rows)
{
if ((bool)r["SELECTED"])
{
//sb.Append("<tr class=\"clsTableRowHighlight\" style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, null, 'on');\" onmouseout=\"javascript:HighlightRow(this, null, 'off');\">");
sb.Append("<tr class=\"clsTableRowHighlight\" style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" >");
}
else
{
sb.Append("<tr style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, null, 'on');\" onmouseout=\"javascript:HighlightRow(this, null, 'off');\">");
}
sb.Append("<td class=\"clsTableRowLeft\"><img onclick=\"javascript:ExpandPart('" + r["SEQ"].ToString() + "')\" src=\"img/Plus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowLeft\">" + r["DESCRIPTION"].ToString() + " </td>");
sb.Append("<td class=\"clsTableRowRight\" align=\"center\">" + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
if ((bool)r["SELECTED"])
{
sb.Append("<tr style='display:none;' class=\"clsTableRowHighlight\" id=\"row_eh_" + r["SEQ"].ToString() + "\" >");
sb.Append("<td class=\"clsTableRowHeadExpandedLeft\"><img onclick=\"javascript:CollapsePart('" + r["SEQ"].ToString() + "');\" src=\"img/Minus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedMiddle\">" + r["DESCRIPTION"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedRight\" align=\"left\">Total Available: " + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
sb.Append("<tr style='display:none;' class=\"clsTableRowHighlight\" id=\"row_ed_" + r["SEQ"].ToString() + "\" >");
sb.Append("<td colspan=\"3\" class=\"clsTableRowDetailExpanded\">");
sb.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-color: Red\">");
}
else
{
sb.Append("<tr style='display:none;' id=\"row_eh_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, 'row_ed_" + r["SEQ"].ToString() + "', 'on');\" onmouseout=\"javascript:HighlightRow(this, 'row_ed_" + r["SEQ"].ToString() + "', 'off');\">");
sb.Append("<td class=\"clsTableRowHeadExpandedLeft\"><img onclick=\"javascript:CollapsePart('" + r["SEQ"].ToString() + "');\" src=\"img/Minus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedMiddle\">" + r["DESCRIPTION"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedRight\" align=\"left\">Total Available: " + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
sb.Append("<tr style='display:none;' id=\"row_ed_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, 'row_eh_" + r["SEQ"].ToString() + "', 'on');\" onmouseout=\"javascript:HighlightRow(this, 'row_eh_" + r["SEQ"].ToString() + "', 'off');\">");
sb.Append("<td colspan=\"3\" class=\"clsTableRowDetailExpanded\">");
sb.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-color: Red\">");
}
int total_rDetail = dsResult.Tables[1].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()).Length;
int current_index = 0;
foreach (DataRow rdetail in dsResult.Tables[1].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()))
{
sb.Append("<tr>");
current_index++;
if (current_index < total_rDetail)
sb.Append(" <td width=\"40\" align=\"right\"><img src=\"img/T.gif\" border=\"0\" /></td>");
else
sb.Append(" <td width=\"40\" align=\"right\"><img src=\"img/L.gif\" border=\"0\" /></td>");
sb.Append(" <td width=\"40\" align=\"right\">Condition: </td>");
sb.Append(" <td width=\"30\">" + rdetail["CONDITION_CODE"].ToString() + "</td>");
sb.Append(" <td width=\"120\" align=\"right\">Location Code: </td>");
sb.Append(" <td >" + rdetail["LOCATION_CODE"].ToString() + " </td>");
sb.Append(" <td width=\"120\" align=\"right\">Cert Source: </td>");
sb.Append(" <td width=\"120\">" + rdetail["CERT_SOURCE"].ToString() + " </td>");
sb.Append(" <td align=\"right\" width=\"74\">Qty: </td>");
sb.Append(" <td width=\"74\">" + rdetail["QTY_AVAILABLE"].ToString() + " </td>");
sb.Append("</tr>");
}
int total_alternate = dsResult.Tables[2].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()).Length;
if (total_alternate > 0)
{
string alternatePartsString = string.Empty;
foreach (DataRow rAlternate in dsResult.Tables[2].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()))
{
alternatePartsString += rAlternate["ALT_PN"].ToString().Trim() + ", ";
}
alternatePartsString = alternatePartsString.Substring(0, alternatePartsString.Length - 2);
sb.Append("<tr><td colspan=\"9\"> </td></tr>");
sb.Append("<tr>");
sb.Append(" <td width=\"40\"> </td>");
sb.Append(" <td align=\"left\" colspan=\"8\">Alternate Part#: " + alternatePartsString + "</td>");
sb.Append("</tr>");
//sb.Append("<tr>");
//sb.Append(" <td width=\"40\"> </td>");
//sb.Append(" <td align=\"left\" colspan=\"7\">" + alternatePartsString + "</td>");
//sb.Append(" <td width=\"74\"> </td>");
//sb.Append("</tr>");
}
sb.Append("<tr><td colspan=\"9\"> </td></tr>");
sb.Append("</table>");
sb.Append("</td>");
sb.Append("</tr>");
}
string sTemp = (string)dsResult.Tables[0].Rows[0]["SEQ"].ToString();
int pTemp = Convert.ToInt32(sTemp);
int nTemp = Convert.ToInt32(sTemp);
pTemp = pTemp - 9;
nTemp = nTemp + 9;
if (Convert.ToInt32(sTemp) <= 1)
{
btnPrevious10.Enabled = false;
ViewState["Previous10"] = null;
}
else
{
btnPrevious10.Enabled = true;
if (pTemp < 1) pTemp = 0;
ViewState["Previous10"] = pTemp.ToString();
}
if (nTemp >= Convert.ToInt32(dsResult.Tables[3].Rows[0]["Max_Seq"]))
{
ViewState["Next10"] = null;
ViewState["Previous10"] = Convert.ToString(pTemp);
btnNext10.Enabled = false;
}
else
{
ViewState["Next10"] = nTemp.ToString();
btnNext10.Enabled = true;
}
}
return sb.ToString();
}
catch (Exception ex)
{
throw (ex);
}
}
}
Thank you so much for your help as I am still lost. Quote:
Last edited by mehere : July 1st, 2009 at 01:16 PM. |
|
#6
|
||||
|
||||
|
Yikes, that looks like asp.net code to me. With C# thrown in for good measure. I don't see a form anywhere in there. btw,
You might want to wrap your code in code tags. Makes it easier to read. Like so Code:
<%@ Page Language="C#" MasterPageFile="~/KRN2007.master" AutoEventWireup="true" CodeFile="inventory_search.aspx.cs" Inherits="inventory_search" Title="Inventory Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MiddleContent" Runat="Server">
<div class="content">
<img src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/partssearch_title_ani.gif" alt=""/>
<br />
<div class="content_inventory_search">
<h2>Parts Search</h2>
<table width="730" border="0" cellspacing="0" cellpadding="0" style="border-color: Red">
<tr align="left"><td colspan="3"> </td></tr>
<tr align="left" valign="top">
<td>
<table border="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td align="right"><b>Part #:</b></td>
<td> </td>
<td align="left">
<asp:TextBox ID="txtPartNumber" runat="server" /></td>
<td> </td>
<td align="left">
<asp:Button ID="btnPartSearch" Text="Search" runat="server" OnCommand="btnPartSearch_Click" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="right"><b>Description:</b></td>
<td> </td>
<td align="left">
<asp:TextBox ID="txtDescription" runat="server" /></td>
<td> </td>
<td align="left">
<asp:Button ID="btnDescSearch" Text="Search" runat="server" OnCommand="btnDescSearch_Click" /></td>
</tr>
</table>
</td>
<td> </td>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0">
<asp:Panel ID="pnlSearchResultInstruction" runat="server" Visible="false" >
<tr><td> </td></tr>
<tr>
<td>
Click on the "
<img src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/Plus.gif" border="0" width="11" height="11" /> " icon for more information<br />
ie. Condition, Cert Source and Alternate Part.
</td>
</tr>
</asp:Panel>
</table>
</td>
</tr>
<tr align="left">
<td colspan="3"> </td>
</tr>
<asp:Panel ID="pnlSearchResultSection" runat="server" Visible="false">
<tr align="left" valign="top">
<td colspan="3">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td style="line-height:20pt; color:#1515D0"><b>Search Results:</b></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<div runat="server" id="pnlSearchResultGrid" />
<div runat="server" id="pnlSearchResultGridNextPage">
<tr>
<td colspan="3" align="right" class="clsTableRowBottomRight">
<
<asp:LinkButton ID="btnPrevious10" runat="server" OnCommand="btnPrevious10_Click" Text="Previous 10" /> >
<
<asp:LinkButton ID="btnNext10" runat="server" OnCommand="btnNext10_Click" Text="Next 10" /> >
</td>
</tr>
</div>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="3" align="center" style="color:#1515D0; font-weight:bold">
For orders or price quotes: call (800) 366-6462 or (480) 753-0752 or
<br />email: <a href="mailto:websales@krn.com">websales@krn.com</a>
</td>
</tr>
<tr>
<td colspan="3"><br /><br /><br /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</asp:Panel>
</table>
</div>
<div class="inventory_search">
<img style="padding-right:10px; padding-top:0px;" src="file:///Macintosh HD/Users/elizabethlangford/Documents/Liz/Elizabeth Langford LLC/Client Files/Project Management/KRN Aviation Services/Website/Original KRN website/new/img/inventory_search.gif" border="0" align="left">
</div>
<div class="inventory_bullets">
<ul>
<li>CESSNA PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>PIPER PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>BEECHCRAFT PARTS: SINGLE & MULTI ENGINE AND TURBO-PROP</li>
<br /><br />
<li>CESSNA CITATION: AIRFRAME PARTS</li>
<br /><br />
<li>LEARJET: AIRFRAME PARTS</li>
<br /><br />
<li>FAIRCHILD / METRO: AIRFRAME PARTS</li>
<br /><br />
<li>CONTINENTAL MOTORS: ENGINE & IGNITION PARTS</li>
<br /><br />
<li>TEXTRON LYCOMING: ENGINE PARTS</li>
<br /><br />
<li>PRATT & WHITNEY: ENGINE PARTS</li>
<br /><br />
<li>GARRETT / ALLIED SIGNAL: ENGINE PARTS, WASTEGATES, VALVES & CONTROLLERS</li>
<br /><br />
<li>CLEVELAND: BRAKES, WHEELS, AND DISCS</li>
<br /><br />
<li>DISTRIBUTORS OF: RAPCO, MCFARLANE, & PMA PRODUCTS</li>
</ul>
</div>
<div class="clearer"> </div>
</div>
</asp:Content>
There is also a css page, here is that code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.SqlClient;
using System.Text;
using System.Web.Configuration;
using System.IO;
public partial class inventory_search : System.Web.UI.Page
{
private const string DBCONNECTION = "KRN_DB_CONNECTION";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["Previous10"] = null;
ViewState["Next10"] = null;
ViewState["SearchByType"] = null;
ViewState["SearchByValue"] = null;
}
}
public void btnPrevious10_Click(Object sender, System.EventArgs e)
{
try
{
int seqID = Convert.ToInt32(ViewState["Previous10"]);
if (Convert.ToString(ViewState["SearchByType"]) != null)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
if (Convert.ToString(ViewState["SearchByType"]) == "BYNUMBER")
{
command.Parameters.AddWithValue("@partnumber", Convert.ToString(ViewState["SearchByValue"]));
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
}
else
{
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", Convert.ToString(ViewState["SearchByValue"]));
}
command.Parameters.AddWithValue("@startseq", seqID);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnNext10_Click(Object sender, System.EventArgs e)
{
try
{
int seqID = Convert.ToInt32(ViewState["Next10"]);
if (Convert.ToString(ViewState["SearchByType"]) != null)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
if (Convert.ToString(ViewState["SearchByType"]) == "BYNUMBER")
{
command.Parameters.AddWithValue("@partnumber", Convert.ToString(ViewState["SearchByValue"]));
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
}
else
{
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", Convert.ToString(ViewState["SearchByValue"]));
}
command.Parameters.AddWithValue("@startseq", seqID);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnDescSearch_Click(Object sender, System.EventArgs e)
{
try
{
if (txtDescription.Text.Trim() != string.Empty)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
command.Parameters.AddWithValue("@partnumber", DBNull.Value);
command.Parameters.AddWithValue("@partdescription", txtDescription.Text.Trim());
command.Parameters.AddWithValue("@startseq", DBNull.Value);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
else
{
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
txtPartNumber.Text = "";
ViewState["SearchByType"] = "BYDESC";
ViewState["SearchByValue"] = txtDescription.Text.Trim();
}
}
catch (Exception ex)
{
throw (ex);
}
}
public void btnPartSearch_Click(object sender, System.EventArgs e)
{
try
{
if (txtPartNumber.Text.Trim() != string.Empty)
{
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = WebConfigurationManager.ConnectionStrings[DBCONNECTION].ConnectionString.ToString();
SqlCommand command = new SqlCommand();
command.Connection = cnn;
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "krn_SearchParts";
command.Parameters.AddWithValue("@partnumber", txtPartNumber.Text.TrimEnd());
command.Parameters.AddWithValue("@partdescription", DBNull.Value);
command.Parameters.AddWithValue("@startseq", DBNull.Value);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds != null)
{
pnlSearchResultInstruction.Visible = true;
pnlSearchResultGrid.InnerHtml = RenderSearchResultTable(ds);
pnlSearchResultSection.Visible = true;
}
else
{
}
ds.Dispose();
command.Dispose();
adapter.Dispose();
cnn.Close();
txtDescription.Text = "";
ViewState["SearchByType"] = "BYNUMBER";
ViewState["SearchByValue"] = txtPartNumber.Text.TrimEnd();
}
}
catch (Exception ex)
{
throw (ex);
}
}
private string RenderSearchResultTable(DataSet dsResult)
{
string outputHTMLGrid = string.Empty;
try
{
//Start construct the HTML to emit.
StringBuilder sb = new StringBuilder();
System.Diagnostics.Debug.WriteLine(HttpUtility.Htm lEncode(">"));
if (dsResult.Tables[0].Rows.Count < 1)
{
pnlSearchResultGridNextPage.Visible = false;
pnlSearchResultInstruction.Visible = false;
sb.Append("<tr>");
sb.Append("<td colspan=\"3\" width=\"100%\" ><b><font color='RED'>No matches were found.</font></b></td>");
sb.Append("</tr>");
}
else
{
pnlSearchResultGridNextPage.Visible = true;
sb.Append("<tr>");
sb.Append("<td width=\"29%\" class=\"clsTableHeaderLeft\"><b>Part #</b></td>");
sb.Append("<td width=\"50%\" class=\"clsTableHeaderLeft\"><b>Description</b></td>");
sb.Append("<td width=\"21%\" class=\"clsTableHeaderRight\" align=\"center\" ><b>Available Quantity</b></td>");
sb.Append("</tr>");
foreach (DataRow r in dsResult.Tables[0].Rows)
{
if ((bool)r["SELECTED"])
{
//sb.Append("<tr class=\"clsTableRowHighlight\" style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, null, 'on');\" onmouseout=\"javascript:HighlightRow(this, null, 'off');\">");
sb.Append("<tr class=\"clsTableRowHighlight\" style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" >");
}
else
{
sb.Append("<tr style='display' id=\"row_h_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, null, 'on');\" onmouseout=\"javascript:HighlightRow(this, null, 'off');\">");
}
sb.Append("<td class=\"clsTableRowLeft\"><img onclick=\"javascript:ExpandPart('" + r["SEQ"].ToString() + "')\" src=\"img/Plus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowLeft\">" + r["DESCRIPTION"].ToString() + " </td>");
sb.Append("<td class=\"clsTableRowRight\" align=\"center\">" + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
if ((bool)r["SELECTED"])
{
sb.Append("<tr style='display:none;' class=\"clsTableRowHighlight\" id=\"row_eh_" + r["SEQ"].ToString() + "\" >");
sb.Append("<td class=\"clsTableRowHeadExpandedLeft\"><img onclick=\"javascript:CollapsePart('" + r["SEQ"].ToString() + "');\" src=\"img/Minus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedMiddle\">" + r["DESCRIPTION"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedRight\" align=\"left\">Total Available: " + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
sb.Append("<tr style='display:none;' class=\"clsTableRowHighlight\" id=\"row_ed_" + r["SEQ"].ToString() + "\" >");
sb.Append("<td colspan=\"3\" class=\"clsTableRowDetailExpanded\">");
sb.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-color: Red\">");
}
else
{
sb.Append("<tr style='display:none;' id=\"row_eh_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, 'row_ed_" + r["SEQ"].ToString() + "', 'on');\" onmouseout=\"javascript:HighlightRow(this, 'row_ed_" + r["SEQ"].ToString() + "', 'off');\">");
sb.Append("<td class=\"clsTableRowHeadExpandedLeft\"><img onclick=\"javascript:CollapsePart('" + r["SEQ"].ToString() + "');\" src=\"img/Minus.gif\" border=\"0\" /> " + r["PN"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedMiddle\">" + r["DESCRIPTION"].ToString() + "</td>");
sb.Append("<td class=\"clsTableRowHeadExpandedRight\" align=\"left\">Total Available: " + r["QTY_AVAILABLE"].ToString() + "</td>");
sb.Append("</tr>");
sb.Append("<tr style='display:none;' id=\"row_ed_" + r["SEQ"].ToString() + "\" onmouseover=\"javascript:HighlightRow(this, 'row_eh_" + r["SEQ"].ToString() + "', 'on');\" onmouseout=\"javascript:HighlightRow(this, 'row_eh_" + r["SEQ"].ToString() + "', 'off');\">");
sb.Append("<td colspan=\"3\" class=\"clsTableRowDetailExpanded\">");
sb.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-color: Red\">");
}
int total_rDetail = dsResult.Tables[1].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()).Length;
int current_index = 0;
foreach (DataRow rdetail in dsResult.Tables[1].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()))
{
sb.Append("<tr>");
current_index++;
if (current_index < total_rDetail)
sb.Append(" <td width=\"40\" align=\"right\"><img src=\"img/T.gif\" border=\"0\" /></td>");
else
sb.Append(" <td width=\"40\" align=\"right\"><img src=\"img/L.gif\" border=\"0\" /></td>");
sb.Append(" <td width=\"40\" align=\"right\">Condition: </td>");
sb.Append(" <td width=\"30\">" + rdetail["CONDITION_CODE"].ToString() + "</td>");
sb.Append(" <td width=\"120\" align=\"right\">Location Code: </td>");
sb.Append(" <td >" + rdetail["LOCATION_CODE"].ToString() + " </td>");
sb.Append(" <td width=\"120\" align=\"right\">Cert Source: </td>");
sb.Append(" <td width=\"120\">" + rdetail["CERT_SOURCE"].ToString() + " </td>");
sb.Append(" <td align=\"right\" width=\"74\">Qty: </td>");
sb.Append(" <td width=\"74\">" + rdetail["QTY_AVAILABLE"].ToString() + " </td>");
sb.Append("</tr>");
}
int total_alternate = dsResult.Tables[2].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()).Length;
if (total_alternate > 0)
{
string alternatePartsString = string.Empty;
foreach (DataRow rAlternate in dsResult.Tables[2].Select("PNM_AUTO_KEY = " + r["PNM_AUTO_KEY"].ToString()))
{
alternatePartsString += rAlternate["ALT_PN"].ToString().Trim() + ", ";
}
alternatePartsString = alternatePartsString.Substring(0, alternatePartsString.Length - 2);
sb.Append("<tr><td colspan=\"9\"> </td></tr>");
sb.Append("<tr>");
sb.Append(" <td width=\"40\"> </td>");
sb.Append(" <td align=\"left\" colspan=\"8\">Alternate Part#: " + alternatePartsString + "</td>");
sb.Append("</tr>");
//sb.Append("<tr>");
//sb.Append(" <td width=\"40\"> </td>");
//sb.Append(" <td align=\"left\" colspan=\"7\">" + alternatePartsString + "</td>");
//sb.Append(" <td width=\"74\"> </td>");
//sb.Append("</tr>");
}
sb.Append("<tr><td colspan=\"9\"> </td></tr>");
sb.Append("</table>");
sb.Append("</td>");
sb.Append("</tr>");
}
string sTemp = (string)dsResult.Tables[0].Rows[0]["SEQ"].ToString();
int pTemp = Convert.ToInt32(sTemp);
int nTemp = Convert.ToInt32(sTemp);
pTemp = pTemp - 9;
nTemp = nTemp + 9;
if (Convert.ToInt32(sTemp) <= 1)
{
btnPrevious10.Enabled = false;
ViewState["Previous10"] = null;
}
else
{
btnPrevious10.Enabled = true;
if (pTemp < 1) pTemp = 0;
ViewState["Previous10"] = pTemp.ToString();
}
if (nTemp >= Convert.ToInt32(dsResult.Tables[3].Rows[0]["Max_Seq"]))
{
ViewState["Next10"] = null;
ViewState["Previous10"] = Convert.ToString(pTemp);
btnNext10.Enabled = false;
}
else
{
ViewState["Next10"] = nTemp.ToString();
btnNext10.Enabled = true;
}
}
return sb.ToString();
}
catch (Exception ex)
{
throw (ex);
}
}
}
Last edited by mystic7 : July 1st, 2009 at 12:45 PM. |
|
#7
|
|||
|
|||
|
So what's my next step?
So if it's asp.net code what do I need to do next? I'm thinking maybe I need to hire someone to do it for me.
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > In Over My Head with ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|