upgrade asp web page to asp.net web form-urgent help please

hi,

I need help to upgrade this classic asp code to

 asp.net 2.0 (code behind). please help. I don't know how to do it.

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="699" id="AutoNumber1" >

<tr>

<td bgcolor="#FFFF99" align="center" width="99"><b>

<font size="1" face="Arial">Delete?</font></b></td>

<td bgcolor="#FFFF99" align="center" width="109"><b>

<font size="1" face="Arial">SSN</font></b></td>

</tr>

 

<%

While Not ObjRS.EOF

If iCount Mod 2 = 0 Then

ibackcolor = "#D7D7FF"

Else

ibackcolor = "#FFFFFF"

End If%>

 

<tr>

<td bgcolor="<%=ibackcolor%>" align="center" width="99"><font size="1">

<input type="submit" value="Del" name="submit" onclick="delfromdb(<%=objRS("id")%>)" style="font-family: Arial; font-size: 8pt"></font>

</td>

<td bgcolor="<%=ibackcolor%>" align="center" width="133">

<font size="1" face="Arial"><%=objRS("filestatus")%></font>&nbsp;

<td bgcolor="<%=ibackcolor%>" align="center" width="109">

<font size="1" face="Arial"><%=objRS("intakelocation")%></font>&nbsp;

<td bgcolor="<%=ibackcolor%>" align="center" width="59">

<font size="1" face="Arial"><%=objRS("first")%></font>

<font size="1" face="Arial"></font>&nbsp;

<td bgcolor="<%=ibackcolor%>" align="center" width="57">

<font size="1" face="Arial">

<a target="_top" href="dbretrieve.aspx?id=<%=objRS("id")%>"><%=objRS("last")%></a>

</font>

<font size="1" face="Arial"></font>&nbsp;

<td bgcolor="<%=ibackcolor%>" align="center" width="125">

<font size="1" face="Arial">(<%=mid(objRS("phone"),1,3)%>) <%= mid(objRS("phone"),4,3)%>-<%= mid(objRS("phone"),7,4)%>

</font>

<td bgcolor="<%=ibackcolor%>" align="center" width="109">

<font size="1" face="Arial"><%=mid(objRS("ssn"),1,3)%>-<%= mid(objRS("ssn"),4,2)%>-<%= mid(objRS("ssn"),6,4)%>

</font>

</tr>

<%

ObjRS.MoveNext()

iCount = iCount + 1

End While

ObjRS.close()

objConn.Close()

ObjRS = Nothing

objConn = Nothing

%>

</table>

any help is gr8tly appreciated thanks

pivi

0
pivi
11/20/2007 12:21:14 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1076 Views

Similar Articles

[PageSpeed] 54

Hi there,

 

I suggest you to use GridView for this. You needn't to hardcode the page like this, as in ASP. And It is very simple. 

 

Please refer the articles at "http://www.datagridgirl.com/articles.aspx" You will get a lots of informations there.

 

Check this : Default.aspx

 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
  
       <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting">
        <Columns>
        <asp:BoundField DataField="id" />
        <asp:BoundField DataField="filestatus" />
        <asp:BoundField DataField="intakelocation" />
        <asp:BoundField DataField="first" />
        <asp:TemplateField>
        <ItemTemplate>
        <a target="_top" href="dbretrieve.aspx?id=<%#Eval("id")%>"><%#Eval("last")%></a>
        </ItemTemplate>
        </asp:TemplateField>
            <asp:TemplateField HeaderText="phone">
                <ItemTemplate>
        (<%#Eval("phone").ToString().Substring(1, 3)%>) <%#Eval("phone").ToString().Substring(4, 3)%>-<%#Eval("phone").ToString().Substring( 7, 4)%>
            </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="SSN">
             <ItemTemplate>
               
        <%#Eval("ssn").ToString().Substring(1, 3)%>-<%#Eval("ssn").ToString().Substring( 4, 2)%>-<%#Eval("ssn").ToString().Substring(6, 4)%>
            </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" />
            </Columns>
            <RowStyle BackColor="#D7D7FF" />
            <AlternatingRowStyle BackColor="#FFFFFF" />
        </asp:GridView>
    </form>
</body>
</html>
 

 

Default.aspx.cs:

 

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;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            //write code to bind datagrid here....
        }
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
       //write code to delete the row from database here...

        //write code to bind datagrid again....
    }
}

 

 

Hope this help you.

 

Srinath~~~~~~~~~~~~


Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. 


srinathgnath

visit blogger.code4asp.net, srinathgnath.blogspot.com
jobsnwalkins.blogspot.com
0
srinathgnath
11/20/2007 2:23:23 AM

Hi,

Visual Basic 2005 includes a Upgrade Wizard tool with new features to continue to help you upgrade your ASP.NET to ASP.NET 2.0

Simply follow the wizard and your application easily converted into the ASP.NET 2.0

Hope it helps.

0
khanalim
11/20/2007 2:31:52 AM
Reply:

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

web web web
Name: bahadir Email: sensiz_olmuyor_t1_at_hotmail.com Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

Please Help!! web parts and .net forms
This is a two part question. 1. i have a simple .net form that captures users input and i want to post to another form to show users input and data from a database into a data grid. In keep posting back to the first form. I have action and method set correctly on my first form, no idea why it post to same form. i even have a response.redirect in the click event of the button on the first form. 2. Does anyone know of any good site/web cast that step you through a basic web part for sharepoint 2007 i am using both visual studio 2005 and 2008. I heard that it is like a 12 step ...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

.Net Web Form & Web Service Deployment
Hi all I have written some test web services and some web form applications and deployed them to my IIS. That's fine but I now want to deploy them to my real IIS server. I have created an msi for each but the problem is I seem to only be able to deploy to the default web site. Our default web site is turned off and instead we use several other sites. Does anybody happen to if Powerbuilder 11 supports non default web sites? If not do I need to hack the msi and if so can anybody suggest a suitable tool. I have Orca but it's not very friendly. Unless of course I knew exactly w...

Sharepoint help! Error msg : "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe"
hihi, I have set up a testing virtual server on my local machine. I installed win server 2003, wss 2.0, sql server 2000, and visual studio .net 2003. i tried to create a project in C# but when i build it and import the web part (.dwp) into the page, there is this error msg "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe"  I seached most of the sites and they informed that the problem lies in the safe control in web.config i enter the safe control in web.config but i does not know where to put ...

Open web page in IE and populate fields on the form from my web form
To the dot net Knights.  Many humble thanks in advance from a dot net surf. We have an vb application that opens multiple instances of IE object, each to different web pages.  It then takes information from the current record in the app, populates fields on each of the web pages, and them submits the forms.  We are then able to look at the resulting web pages and quickly get the info we're looking for.This prevents us from having to manually navigate to each web site, enter the same information and then wait for the page to open.  If there is ...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

calling a web form from another web form
I would like to know what is the best way to open a web form from another web form. I would like to call it from a button control. Thanks Well, if I've grasped your question right, there are many methods to do that: 1)Response.Redirect > To navigate to another page from code and is equal to clicking a hyperlink. I suggest this as I think it's closer to your question. 2)Server.Transfer > This ends the current web form and begins a new web form. It's usable when you want to pass some variables i.e (Label1.Text) to the next immediate page. It's not safe though and not used to send p...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

Web Form embedded in another Web Form
Hi,  I have programmed a Web Form which acts like a scientific calculator. I would like to embedd this calculator in the upper left hand corner of another accounting Web Form. I don't want to host the calculator on the same server as the accounting page. I.e. I want them to have distinct URLs. Classically, I would do this using frames, but is there a better way using ASP? Is there some sort of Panel which can display the webpage at a specific URL which I can just drag onto my accounting Web Form? Thanks,  P1000   Frames are the only way to embed a webform inside ano...

Web resources about - upgrade asp web page to asp.net web form-urgent help please - asp.net.web-forms

Resources last updated: 12/17/2015 7:53:06 PM