Link to home
Start Free TrialLog in
Avatar of dprasad
dprasad

asked on

Adding codebehind files to an app. developed using .net framework

I made a site using a text editor and the .net framework..compiling it from the command line. I now have visual studio 2003 and want to alter the application from within it. Below is one such file, can someone give me an idea on this?

 <%@ Page Language="C#" %>
<%@ Import Namespace="System.Data.SqlClient" %>


<script runat="server">

void Page_Load (object Sender, EventArgs e) {


}

void makeselection_Click(Object sender, System.EventArgs e) {
      string col;
      string cat;
      string yea;
      string reg;
      string cou;
      string app;
      
      /*try
{
Session["color"] = color.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
  Session["color"] = "-1";

}  
try
{
Session["category"] = category.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
  Session["category"] = "-1";
}
try
{
 Session["year"] = year.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
   Session["year"] =  "-1";
}        
      
try
{
 Session["region"] = region.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
   Session["region"] =  "-1";
}      
try
{
 Session["country"] = country.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
   Session["country"] =  "-1";
}                

try
{
 Session["appellation"] = appellation.SelectedItem.Text;
  }
catch(System.Exception NotSelected)
{
   Session["appellation"] =  "-1";
}        

      */
      col = color.SelectedItem.Text;
            if (col!="") {
            Session["color"] = color.SelectedItem.Text;
            }
            else {
            Session["color"] = "";
            }
            
      cat = category.SelectedItem.Text;      
            if (cat!="") {
            Session["category"] = category.SelectedItem.Text;
            }
            else {
            Session["category"] = "";
            }
      yea = year.SelectedItem.Text;
            if (yea!="") {
            Session["year"] = year.SelectedItem.Text;
            }      
          else {
            Session["year"] = "";
            }
      reg = region.SelectedItem.Text;
            if (reg!="") {
            Session["region"] = region.SelectedItem.Text;
            }      
            else {
            Session["region"] = "";
            }
      cou = country.SelectedItem.Text;
            if (cou!="") {
            Session["country"] = region.SelectedItem.Text;
            }      
            else {
            Session["country"] = "";
            }
      app = appellation.SelectedItem.Text;
            if (app!="") {
             Session["appellation"] = appellation.SelectedItem.Text;
             
            }
            else {
             Session["appellation"] = "";
            }
                  
            
                      //Session["color"] = color.SelectedItem.Text;
//                  Session["category"] = category.SelectedItem.Text;
                  //Session["price"] = price.SelectedIndex;
            //      Session["year"] = year.SelectedItem.Text;
                  
                  
                  

                  
                  Response.Redirect("winelist.aspx");
                  
                  

             }
void emailoffer(Object sender, System.EventArgs e)
{



}                   
</script>
<html>

      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <meta name="generator" content="Adobe GoLive">
      <title>Untitled Page</title>
      <style type="text/css">
<!--
body {
      background-color: #FFFFFF;
}
.style2 {font-size: 9px}
-->
    </style>
      <script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
    </script>
      </head>
<body>
             <p align="center"><img src="e2.jpg" width="694" height="209"></p>
             <table width="81%" height="203"  border="0">
           <tr height="206">
             <td width="54%" height="206">                     <div align="center">Shop the largest online assortment of wines from around the world.From exciting new wines to monthly best sellers, you'll find greattasting wines for any occasion. </div></td>
             <td width="46%" height="206"><img src="top1.gif" width="229" height="170"></td>
           </tr>
</table>
                          <table width="769" border="0" cellpadding="0" cellspacing="0">
                   <tr>
                     <td width="759"><hr noshade></td>
                   </tr>
                 </table>
                      <p>&nbsp;</p>
<form runat="server">
             Category: <asp:DropDownList id="category" runat="server">
                         <asp:ListItem Text=""/>              
                         <asp:ListItem Text="Arneis"/>              
                         <asp:ListItem Text="Barbera"/>              
                         <asp:ListItem Text="Bordeaux"/>              
                         <asp:ListItem Text="Cabernet Sauvignon"/>              
                         <asp:ListItem Text="Chardonnay"/>              
                         <asp:ListItem Text="Coastal South Africa"/>              
                         <asp:ListItem Text="Colchagua"/>              
                         <asp:ListItem Text="Corvina"/>              
                         <asp:ListItem Text="Fortified Blend"/>              
                         <asp:ListItem Text="Fume Blanc"/>              
                         <asp:ListItem Text="Gamay"/>              
                         <asp:ListItem Text="Greco"/>              
                         <asp:ListItem Text="Malbec"/>              
                         <asp:ListItem Text="Marsanne"/>              
                         <asp:ListItem Text="Merlot"/>              
                         <asp:ListItem Text="Montepulciano"/>              
                         <asp:ListItem Text="Moscato"/>              
                         <asp:ListItem Text="Muscadet"/>              
                         <asp:ListItem Text="Nebbiolo"/>              
                         <asp:ListItem Text="Pauillac"/>              
                         <asp:ListItem Text="Pinot Blanc"/>              
                         <asp:ListItem Text="Pinot Bianco"/>              
                         <asp:ListItem Text="Pinot Grigio"/>              
                         <asp:ListItem Text="Pinot Gris"/>              
                         <asp:ListItem Text="Pinot Noir"/>              
                         <asp:ListItem Text="Primitivo "/>              
                         <asp:ListItem Text="Red Blend"/>              
                         <asp:ListItem Text="Rhone Valley"/>              
                         <asp:ListItem Text="Riesling "/>              
                         <asp:ListItem Text="Rose Blend "/>              
                         <asp:ListItem Text="Sake"/>              
                         <asp:ListItem Text="Sangiovese"/>              
                         <asp:ListItem Text="Sauvignon Blanc"/>              
                         <asp:ListItem Text="Semillon "/>              
                         <asp:ListItem Text="Shiraz"/>              
                         <asp:ListItem Text="Sparkling Blend "/>              
                         <asp:ListItem Text="Sweet Blend"/>              
                         <asp:ListItem Text="Syrah"/>              
                         <asp:ListItem Text="Tempranillo"/>              
                         <asp:ListItem Text="White"/>              
                         <asp:ListItem Text="White Blend"/>              
                         <asp:ListItem Text="Viognier"/>              
                         <asp:ListItem Text="Zinfandel"/>              
        </asp:DropDownList>
                   
                 Region:
                         <asp:DropDownList id="region" runat="server">
                           <asp:ListItem Text=""/>                
                           <asp:ListItem Text="Abruzzi"/>                
                           <asp:ListItem Text="Alsace"/>                
                           <asp:ListItem Text="Andalucia"/>                
                           <asp:ListItem Text="Bordeaux"/>                
                           <asp:ListItem Text="Burgundy"/>                
                           <asp:ListItem Text="California"/>                
                           <asp:ListItem Text="Campania"/>                
                           <asp:ListItem Text="Catalonia"/>                
                           <asp:ListItem Text="Coastal South Africa"/>                
                           <asp:ListItem Text="France"/>                
                           <asp:ListItem Text="Friuli-Venezia Giulia"/>                
                           <asp:ListItem Text="Languedoc-Roussillon"/>                
                           <asp:ListItem Text="La Rioja"/>                
                           <asp:ListItem Text="Loire Valley"/>                
                           <asp:ListItem Text="Lombardy"/>                
                           <asp:ListItem Text="Madeira"/>                
                           <asp:ListItem Text="Maule Valle"/>                
                           <asp:ListItem Text="Mendoza"/>                
                           <asp:ListItem Text="New South Wales"/>                
                           <asp:ListItem Text="Oregon"/>                
                           <asp:ListItem Text="Paarl"/>                
                           <asp:ListItem Text="Piedmont"/>                
                           <asp:ListItem Text="Puglia"/>                
                           <asp:ListItem Text="Rapel"/>                
                           <asp:ListItem Text="Rhone Valley"/>                
                           <asp:ListItem Text="Sake"/>                
                           <asp:ListItem Text="Sicily"/>                
                           <asp:ListItem Text="Southern"/>                
                           <asp:ListItem Text="South Island, NZ"/>                
                           <asp:ListItem Text="South Africa"/>                
                           <asp:ListItem Text="South Australia "/>                
                           <asp:ListItem Text="Trentino-Alto Adige"/>                
                           <asp:ListItem Text="Tuscany"/>                
                           <asp:ListItem Text="Veneto"/>                
                           <asp:ListItem Text="Vin de Pays"/>                
                           <asp:ListItem Text="Washington"/>                
                           <asp:ListItem Text="Western Australia"/>                
        </asp:DropDownList>
                 Country:
                 
                       <asp:DropDownList id=country runat=server>
                         <asp:ListItem Text=""/>              
                         <asp:ListItem Text="Argentina"/>              
                         <asp:ListItem Text="Australia"/>              
                         <asp:ListItem Text="Chile"/>              
                         <asp:ListItem Text="France"/>              
                         <asp:ListItem Text="Italy"/>              
                         <asp:ListItem Text="Japan"/>              
                         <asp:ListItem Text="New Zealand"/>              
                         <asp:ListItem Text="Spain"/>              
                         <asp:ListItem Text="South Africa"/>              
                         <asp:ListItem Text="USA"/>              
        </asp:DropDownList>
            <p></p>
                  Color:                    
                       <asp:DropDownList ID=color runat=server>
                         <asp:ListItem Text=""/>              
                         <asp:ListItem Text="Red" />              
                         <asp:ListItem Text="Rose" />              
                         <asp:ListItem Text="Sparkling" />              
                         <asp:ListItem Text="Sweet" />              
        </asp:DropDownList>
                Appellation:
                         <asp:DropDownList ID=appellation runat=server>
                           <asp:ListItem Text=""/>                
                           <asp:ListItem Text="Alexander Valley " />                
                           <asp:ListItem Text="Alsace" />                
                           <asp:ListItem Text="Alto Adige" />                
                           <asp:ListItem Text="Amador County " />                
                           <asp:ListItem Text="Amarone della Valpolicella" />                
                           <asp:ListItem Text="Arneis di Roero" />                
                           <asp:ListItem Text="Barbaresco" />                
                           <asp:ListItem Text="Barbera dAlba" />                
                           <asp:ListItem Text="Barolo " />                
                           <asp:ListItem Text="Barossa Valley" />                
                           <asp:ListItem Text="Barsac" />                
                           <asp:ListItem Text="Beaujolais" />                
                           <asp:ListItem Text="Beaujolais-Villages" />                
                           <asp:ListItem Text="Bordeaux" />                
                           <asp:ListItem Text="Brunello di Montalcino" />                
                           <asp:ListItem Text="Cairanne" />                
                           <asp:ListItem Text="California" />                
                           <asp:ListItem Text="California Shenandoah Valley" />                
                           <asp:ListItem Text="Carneros" />                
                           <asp:ListItem Text="Carneros, Napa" />                
                           <asp:ListItem Text="Cava" />                
                           <asp:ListItem Text="Chateauneuf-du-Pape, Rouge" />                
                           <asp:ListItem Text="Chianti" />                
                           <asp:ListItem Text="Chianti Classico" />                
                           <asp:ListItem Text="Chianti Classico Riserva " />                
                           <asp:ListItem Text="Coastal South Africa " />                
                           <asp:ListItem Text="Colchagua" />                
                           <asp:ListItem Text="Columbia Valley " />                
                           <asp:ListItem Text="Costieres de Nimes" />                
                           <asp:ListItem Text="Coteaux de Luberon, Rouge" />                
                           <asp:ListItem Text="Coteaux du Languedoc " />                
                           <asp:ListItem Text="Cotes de Castillon" />                
                           <asp:ListItem Text="Cotes-du-Rhone, Rouge" />                
                           <asp:ListItem Text="Franciacorta " />                
                           <asp:ListItem Text="Gattinara" />                
                           <asp:ListItem Text="Gavi" />                
                           <asp:ListItem Text="Givry, Rouge " />                
                           <asp:ListItem Text="Graves" />                
                           <asp:ListItem Text="Greco di Tufo" />                
                           <asp:ListItem Text="Haut-Medoc" />                
                           <asp:ListItem Text="Howell Mountain " />                
                           <asp:ListItem Text="Hunter Valley " />                
                           <asp:ListItem Text="IGT, Puglia " />                
                           <asp:ListItem Text="IGT, Sicily" />                
                           <asp:ListItem Text="IGT, Toscana" />                
                           <asp:ListItem Text="IGT, Toscana " />                
                           <asp:ListItem Text="IGT, Toscana" />                
                           <asp:ListItem Text="IGT, Veneto" />                
                           <asp:ListItem Text="IGT, Venezia Giulia " />                
                           <asp:ListItem Text="Jerez (Sherry)" />                
                           <asp:ListItem Text="Langhe" />                
                           <asp:ListItem Text="Langhorne Creek" />                
                           <asp:ListItem Text="Madeira" />                
                           <asp:ListItem Text="Margaret River" />                
                           <asp:ListItem Text="Margaux" />                
                           <asp:ListItem Text="Marlborough" />                
                           <asp:ListItem Text="Martinborough" />                
                           <asp:ListItem Text="Maule Valley" />                
                           <asp:ListItem Text="McLaren Vale" />                
                           <asp:ListItem Text="Medoc" />                
                           <asp:ListItem Text="Mendoza" />                
                           <asp:ListItem Text="Montepulciano dAbruzzo" />                
                           <asp:ListItem Text="Monterey County" />                
                           <asp:ListItem Text="Moscato dAsti" />                
                           <asp:ListItem Text="Moulis" />                
                           <asp:ListItem Text="Muscadet" />                
                           <asp:ListItem Text="Napa Valley" />                
                           <asp:ListItem Text="Nebbiolo dAlba" />                
                           <asp:ListItem Text="New South Wales" />                
                           <asp:ListItem Text="Oregon" />                
                           <asp:ListItem Text="Paarl" />                
                           <asp:ListItem Text="Pauillac" />                
                           <asp:ListItem Text="Pessac-Leognan " />                
                           <asp:ListItem Text="Pic Saint Loup" />                
                           <asp:ListItem Text="Pomero" />                
                           <asp:ListItem Text="Pomerol" />                
                           <asp:ListItem Text="Puligny-Montrachet" />                
                           <asp:ListItem Text="Rioja" />                
                           <asp:ListItem Text="Russian River Valley" />                
                           <asp:ListItem Text="San Gimignano" />                
                           <asp:ListItem Text="Santa Barbara County" />                
                           <asp:ListItem Text="Santa Cruz Mountains" />                
                           <asp:ListItem Text="Santa Lucia Highlands" />                
                           <asp:ListItem Text="Santa Maria Valley" />                
                           <asp:ListItem Text="Santa Ynez Valley" />                
                           <asp:ListItem Text="Sauternes" />                
                           <asp:ListItem Text="Sonoma County " />                
                           <asp:ListItem Text="South Africa" />                
                           <asp:ListItem Text="South Australia" />                
                           <asp:ListItem Text="South Eastern Australia " />                
                           <asp:ListItem Text="Spring Mountain District " />                
                           <asp:ListItem Text="St. Emilion " />                
                           <asp:ListItem Text="St. Estephe " />                
                           <asp:ListItem Text="St. Julien " />                
                           <asp:ListItem Text="Tokubetsu Junmai " />                
                           <asp:ListItem Text="Vaucluse " />                
                           <asp:ListItem Text="Vin de Pays " />                
                           <asp:ListItem Text="Willamette Valley " />                
        </asp:DropDownList>
                 Year:
               
                       <asp:DropDownList ID="year" runat="server">
                         <asp:ListItem Text=""/>              
                         <asp:ListItem Text="1995"  />              
                         <asp:ListItem Text="1996"  />              
                         <asp:ListItem Text="1997"  />              
                         <asp:ListItem Text="1998"  />              
                         <asp:ListItem Text="1999"  />              
                         <asp:ListItem Text="2000"  />              
                         <asp:ListItem Text="2001"  />              
                         <asp:ListItem Text="2001 Future"  />              
                         <asp:ListItem Text="2002"  />              
                         <asp:ListItem Text="2002 Future"  />              
                         <asp:ListItem Text="2003"  />              
                         <asp:ListItem Text="2003 Future"  />              
        </asp:DropDownList>
                  <input name="Button" type="Button" id="Left" value="Go" runat="server" onserverclick="makeselection_Click" />
</form>
             
             <p>&nbsp;</p>
             <table width="769" border="0" cellpadding="0" cellspacing="0">
           <tr>
             <td width="759"><hr noshade></td>
           </tr>
         </table>
          <table width="86%" height="562"  border="0">
          <tr>
                        <td width="40%" height="287" valign="top"><p align="center">&nbsp;</p>
                          <p align="center"><img src="41.gif" width="194" height="124" align="top"></p>
                          <p align="center"><img src="saveas.gif" width="184" height="30"></p>
                  </td>
                        <td width="28%"><p align="center">Last summer we approached some of our favorite
    American wineries and asked them if we could
    choose a couple of exceptional barrels to do a
    special blend that we would have a hand in
    creating. </p>
                          <div align="center"> The winemakers were really enthusiastic about the idea and picked out some incredible barrrels for us to use in our blends. The fruits of this collaboration have begun to arrive and we expect to have the full complement in stock by the end of August.              </div>
                          </p>
<p></p></td>
                        <td width="32%" valign="top"><div align="center">
                          <p align="center">&nbsp;</p>
                          <p align="center"><img src="duk3.gif" align="bottom"></p>
                        </div></td>
          </tr>
          <tr>
            <td height="137" align="center" valign="top"><blockquote>
              <p>Bethel Heights Pinot Noir &quot;Freedom Hill Vineyard&quot; Willamette Valley 750ml 12 per case<br>
                  <b>Vintage:</b> 1999<br>
                  <b>Price per Bottle:</b> 10<br>
                <b>Price per case of 12:</b> 11<br>              
               <a href="itemdetails.aspx?itemdid=149">Read More ... </a> <br>
              </blockquote></td>
            <td valign="top"><p align="center">            
              <p align="center">Baron Philippe de Rothschild Chardonnay Vin de Pays 750ml 12 per case <br>
                <b>Vintage: </b> 2002 <br>
                <b>Price per Bottle: </b>10 <br>
                <b>Price per case of 12: </b> 11<BR>            
                <a href="itemdetails.aspx?itemdid=162">Read More ... </a><BR>
              </td>
            <td valign="top"><p align="center">            
              <p align="center">Castello di Volpaia Chianti Classico Riserva 750ml 12 per case<br>
                <b>Vintage:</b> 1999<br>
                <b>Price per Bottle: 10</b><br>
                <b>Price per case of 12:</b> 11<BR>
                <a href="itemdetails.aspx?itemdid=94">Read More ... </a><BR>
              <p align="center">&nbsp;</p></td>
          </tr>
          <tr>
            <td height="111" align="center" valign="top"> <p>            
              <p>Allegrini "La Poja" IGT, Veneto 750ml <br>            
              6 per case (6 per case) <BR>
                  <B>Vintage: </B>1998 <BR>
                  <B>Price per Bottle: </B>10 <BR>
                  <B>Price per case of 12: </B>11 <BR>
                <a href="itemdetails.aspx?itemdid=199">Read More ... </a></td>
            <td valign="top"><div align="center">
              <p>Castello di Volpaia Chianti ClassicoRiserva 750ml 12 per case<BR>
                <strong>Vintage: </strong>1997<BR>            
                <strong>Price per Bottle: </strong>10<BR>              
                      <strong>Price per case of 12:</strong> 11<br>
<a href="itemdetails.aspx?itemdid=199">Read More ...</a> <br>
            </div></td>
            <td valign="top"><div align="center">
              <p>Beringer Chardonnay &quot;Founders Estate&quot; California 750ml 12 per case<br>
                <strong>Vintage:</strong> 2002<br>
                <strong>Price per Bottle:</strong> 10<br>
                <strong>Price per case of 12:</strong> 11 <br>
                        <a href="itemdetails.aspx?itemdid=196">Read More ...</a>
            </div></td>
          </tr>
</table>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p align="left">&nbsp;</p>
            <p align="right"><span class="style2">&copy; The Wine Repository, 2002. All Rights Reserved. <img src="half2.gif" width="106" height="222" align="bottom"></span></p>
</body>

</html>
Avatar of puranik_p
puranik_p
Flag of India image

You have to put all the code between..
<script runat="server">
.........
</script>

in the codebehind page. That's it.
SOLUTION
Avatar of Razzie_
Razzie_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
changes to the Button...
<input name="GoButton" type="Button" id="Left" value="Go" runat="server" />
i mean,
<asp:Button Id="GoButton" runat="server" Text="Go" />
Please do have a look at my comments ..
Avatar of Razzie_
Razzie_

I would personally recommend a split between

Razzie_ (<a href="https://www.experts-exchange.com/questions/21393697/Adding-codebehind-files-to-an-app-developed-using-net-framework.html#13813230">#13813230</a>)
Rejojohny (<a href="https://www.experts-exchange.com/questions/21393697/Adding-codebehind-files-to-an-app-developed-using-net-framework.html#13813728">#13813728</a>)
b1xml2 (<a href="https://www.experts-exchange.com/questions/21393697/Adding-codebehind-files-to-an-app-developed-using-net-framework.html#13815395">#13815395</a>)

since they all more or less accomplish what the author asked. I think it would be the fairest thing to do.
hmm sorry for the misformed post, I guess HTML doesn't work ;)