Home > ASP Development > DATAGrids in ASP

DATAGrids in ASP



Is there a to build a datagrid in asp that doesn't use the file extension aspx and doesn't use

Code:


<%@ Import Namespace="System.Data.OleDb" %>


. I'm trying to build a form that pulls information from a db and has a approve or decline link and a edit button that allow instant change of the information. Here is what I have so far but I can't get it to work because of the web.config. I'm using sessions to varify that the users is logged in.




Code:



<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Worker Management System --- Powered by Guthnur.NET</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="print" href="css/print.css">
<style type="text/css" media="screen">
@import url("css/layout.css");
@import url("css/content.css");
@import url("css/docbook.css");
</style>
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<script runat="server" language="VB">
Dim objConn As New OleDbConnection("Provider=SQLOLEDB;Server=aspsrv;UID=sa;PASSWORD=mo nkey;DATABASE=rit;")
Dim objCmd As OleDbCommand
Dim objRdr As OleDbDataReader
Dim strCmd As String

Sub Page_Load()
If Not IsPostBack Then
BindData()
End If
End Sub

Sub BindData()
objCmd = New OleDbCommand("SELECT * FROM dayoff", objConn)
objConn.Open()
objRdr = objCmd.ExecuteReader()
dgAddressBook.DataSource = objRdr
dgAddressBook.DataBind()
objRdr.Close()
objConn.Close()
End Sub
</script>
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="icon" href="images/favicon.ico">
</head>

<body>
<!-- header BEGIN -->
<div id="wms-header">
<div id="wms-header-logo">
<a href="/"><img src="images/header-wms_logo.png" width="20" height="40" alt="wms Project"></a>
</div>
<div id="wms-header-items">
<span class="wms-header-icon">
<a href="/calendar/"><img src="images/header-calendar.png" alt=" ">My Calendar</a>
<a href="/profile.asp"><img src="images/header-projects.png" alt=" ">My Profile</a>
<a href="/about/faq/"><img src="images/header-faq.png" alt=" ">FAQ</a></span>
</div>
</div>
<div id="wms-nav">
<!-- header END -->
</div>
<!-- leftside BEGIN -->
<div id="wms-side-left">
<div class="wms-welcome">Hello, <% Response.Write(Session("fname"))%></div><br>
<!--#include file="menu.asp"-->
<!-- leftside END -->

<!-- content BEGIN -->
<div id="wms-middle-three">
<div class="wms-corner-tr">&nbsp;</div>
<div class="wms-corner-tl">&nbsp;</div>
<div id="wms-content">
<h1>Day Off system</h1>
<p>
<table>
<td>
<h1>Requests</h1>
<p><asp:DataGrid id="dgAddressBook" runat="server" AutoGenerateColumns="false" CellPadding="4" GridLines="None">
<ItemStyle Font-Name="Arial" Font-Size="10pt" ForeColor="#000000" />
<HeaderStyle Font-Name="Arial" Font-Size="10pt" Font-Bold="true" BackColor="#003366" ForeColor="#FFFFFF" />
<AlternatingItemStyle Font-Name="Arial" Font-Size="10pt" BackColor="#CCCCCC" />
<Columns>
<asp:BoundColumn DataField="fname" HeaderText="First Name" />
<asp:BoundColumn DataField="lname" HeaderText="Last Name" />
<asp:BoundColumn DataField="date" HeaderText="date" />
<asp:BoundColumn DataField="reason" HeaderText="reason" />
<asp:BoundColumn DataField="daterequest" HeaderText="daterequest" />
<asp:BoundColumn DataField="email" HeaderText="email" />
<asp:BoundColumn DataField="phone1" HeaderText="Phone" />
<asp:BoundColumn DataField="approve" HeaderText="Approve" />
</Columns>
</asp:DataGrid></p></td>
</table>
</p>
</div>
<div class="wms-corner-br">&nbsp;</div>
<div class="wms-corner-bl">&nbsp;</div>
</div>
<!-- content END -->
<!-- footer BEGIN -->
<div id="wms-footer">
Copyright ?2005-2008 Richard Genthner. All rights reserved.
<br>The Work Management System is not a supported project of Rochester Institute of Technology.
<br><a href="/legal/">Legal</a> | <a href="/about/trademarks/">Trademark Guidelines</a>
<br>
This page last modified at: <%=time()%><%Response.Write(" ")%><%=monthname(month(now))%><%Response.Write(" ")%><%=day(now)%>,<%=year(now)%>
<br>
</div>
<!-- footer END -->
</body>
</html>






web.config


Code:



<configuration>
<appSettings>
<add key="DSN" value="Provider=SQLOLEDB;Server=aspsrv;UID=sa;PASSWORD=mo nkey;DATABASE=rit;" />
</appSettings>
<system.web>
<authentication mode="Forms" />
<authorization>
<deny>Session("level")<3</deny>
</authorization>
</system.web>
</configuration>




any help would be great!

    
Guest


There are some aftermarket asp datagrids but I don't know of any that are free.



But all the code you posted is NET code and you'll have to use the .aspx extension to get it to run.

Was this answer helpful ? Yes No   
Guest


Here is a tutorial on how to do this

http://www.developerfusion.co.uk/show/2328/

I haven't followed it so I don't know how good it is

Was this answer helpful ? Yes No   
Guest


Elija

Nice new avatar

Was this answer helpful ? Yes No   
Guest


Thanx - I'm still messing it though

Was this answer helpful ? Yes No   
Guest


Ok carry on and arrive with a new attractive one

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by elijathegold
Here is a tutorial on how to do this

http://www.developerfusion.co.uk/show/2328/

I haven't followed it so I don't know how good it is
nice, reminds me of the ArrayList Class I've made some while ago...

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by sheeba
Ok carry on and arrive with a new attractive one




LOL All I want to do is make a snort of smoke come out of the nose

and float away, but every time I do, it looks rubbish



(I can't claim credit for the original image, its a freebie that I found)

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by elijathegold
LOL All I want to do is make a snort of smoke come out of the nose

and float away, but every time I do, it looks rubbish



(I can't claim credit for the original image, its a freebie that I found)
you might consider contacting splinters, he's real Avatar Master.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved