GridView and SQLDataSource

C

CBKowitz

Trying a simple (Ha Ha) gridview and SQLDatasource combination. When I run
the page nothing shows. Here's the code:

<%@ Page Language="vb" AutoEventWireup="false"
Inherits="TestSystemSecurity.SecurityFormList" enableViewState="True"
CodeFile="SecurityFormList.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Security Form List</title>
<%
writeLoadSteps()
%>
<script src="numjs.js"></script>
<script language="javascript">

window.name = "SecFormList"

function submitIt()
{
document.frmSecurityFormList.recAdded.value = 1;

document.frmSecurityFormList.submit();
}
</script>
</HEAD>
<body onload="loadSteps()">
<div align="center">
<form id="frmSecurityFormList" method="post" runat="server">
<INPUT value="0" type="hidden" name="recAdded">
<asp:label id="lblTitle" runat="server" Height="24px" SkinID=DB_14B
Width="761px">
View / Update Security Form List
</asp:label>
<br>
<br>

<asp:GridView ID="gvSecurityList" runat="server" Width="1005px"
SkinID="RainyDay8" PageSize="15" AutoGenerateColumns=False CellPadding="3"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
DataSourceID="sqlDSFormList" AllowPaging="True">
<Columns>
<asp:BoundField DataField="ID" SortExpression="ID"
ReadOnly="True" HeaderText="ID">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="FORM NAME" SortExpression="FORM NAME"
HeaderText="Form Name">
<HeaderStyle Width="250px"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="CONTROL NAME" SortExpression="CONTROL
NAME" HeaderText="Control Name">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="DESCRIPTION"
SortExpression="DESCRIPTION" HeaderText="Description">
<HeaderStyle Width="300px"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="ROLES" SortExpression="ROLES"
HeaderText="Security Roles">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundField>
</Columns>
</asp:GridView>

<br>
<asp:SqlDataSource ID="sqlDSFormList" runat="server"
ConnectionString="Connection String Not Shown"
DeleteCommand="spDeleteSecurityFormListTable"
DeleteCommandType="StoredProcedure"
InsertCommand="spInsertSecurityFormListTable"
InsertCommandType="StoredProcedure"
ProviderName="System.Data.SqlClient"
SelectCommand="spSelectSecurityFormListTable"
SelectCommandType="StoredProcedure"
UpdateCommand="spUpdateSecurityFormListTable"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:parameter Name="IdxId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="FormName" Type="String" />
<asp:parameter Name="ControlName" Type="String" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Roles" Type="String" />
<asp:parameter Name="IdxId" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter DefaultValue="-1" Name="IdxId"
SessionField="IdxID" Type="Int32" />
<asp:SessionParameter DefaultValue="" Name="Role"
SessionField="ViewRole" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:parameter Name="FormName" Type="String" />
<asp:parameter Name="ControlName" Type="String" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Roles" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<br>
<asp:ImageButton id="btnExit" runat="server"
ImageUrl="images/exit.gif"></asp:ImageButton>

<asp:ImageButton id="btnAdd" runat="server"
ImageUrl="images/add.gif"></asp:ImageButton>
</form>
</div>
</body>
</HTML>
 
R

Riki

Since you're using two session parameters in your select command,
are you sure they have been initialized?

Somehow, your select statement is producing zero records, that's why the
gridview doesn't show up.

-- Riki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top