Forums
This topic is locked
HELP! ASP.NET Datagrid problem.
Posted 01 Apr 2004 11:41:23
1
has voted
01 Apr 2004 11:41:23 Ibnu Haris posted:
I'm a newbie is ASP.net, I'm using DWMX for the development. I'm doing a query and I want it displayed on a datagrid. The query is fine, I've tested it in SQL Query Analyzer. When I put into the query my variables it returns the datagrid just fien. However, it I change the variables to URL variable(@variable), which is the input from dropdown lists and textbox, the query does not return any results in the DataGrid. Here's my code. Can anyone help? FYI, I'm doing it in DWMX. <pre id=code><font face=courier size=2 id=code>
</head>
<body>
<form action="" method="post" name="UpdateItem" id="UpdateItem" runat="server" >
<p> </p>
<table width="69%" border="0" cellpadding="2" cellspacing="2" bordercolor="#FFFFFF" class="Body" id="TblnsItem">
<tr bordercolor="#999999">
<td class="Body"><div align="right"><strong>Retailer Name</strong></div></td>
<td> <div align="left">
<asp:dropdownlist DataSource="<%#RetailerName.DefaultView%>" DataTextField="RetName" DataValueField="RetName" ID="RetName" Rows="1" runat="server" SelectionMode="single"></asp:dropdownlist>
</div></td>
<td> </td>
<td> </td>
</tr>
<tr bordercolor="#999999">
<td class="Body"><div align="right"><strong>Promo Date Start</strong></div></td>
<td> <div align="left">
<asp:dropdownlist DataSource="<%#DateDS.DefaultView%>" DataTextField="PromoDateStart" DataValueField="PromoDateStart" ID="PromoDateStart" Rows="1" runat="server" SelectionMode="single"></asp:dropdownlist>
</div></td>
<td> </td>
<td> </td>
</tr>
<tr bordercolor="#999999">
<td width="30%" class="Body"> <div align="right"><strong>Item Brand</strong></div></td>
<td> <div align="left">
<asp:textbox ID="ItemBrand" runat="server" TextMode="SingleLine" />
</div></td>
<td> </td>
<td> </td>
</tr>
<% if Request("error" = "true" then %>
<% end if %>
<tr bordercolor="#999999">
<td> </td>
<td width="27%"> <div align="right">
<asp:button ID="Select" runat="server" Text="Select Item" />
</div></td>
<td width="21%"> </td>
<td width="22%"> </td>
</tr>
</table>
<p> </p>
<aspataGrid
AllowCustomPaging="true"
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0" DataKeyField="ItemID2"
DataSource="<%# GetItem.DefaultView %>" id="ItemGrid"
PagerStyle-Mode="NumericPages"
PageSize="<%# GetItem.PageSize %>"
runat="server"
ShowFooter="false"
ShowHeader="true" OnUpdateCommand="GetItem.OnDataGridUpdate" OnEditCommand="GetItem.OnDataGridEdit"
OnPageIndexChanged="GetItem.OnDataGridPageIndexChanged" OnCancelCommand="GetItem.OnDataGridCancel" OnDeleteCommand="GetItem.OnDataGridDelete" OnItemDataBound="GetItem.OnDataGridItemDataBound"
VirtualItemCount="<%# GetItem.RecordCount %>"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:EditCommandColumn
ButtonType="PushButton"
CancelText="Cancel"
EditText="Edit"
HeaderText="Edit Item"
UpdateText="Update"
Visible="True"/>
<asp:BoundColumn DataField="RetID2"
HeaderText="Retailer ID"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="RetName"
HeaderText="Retailer Name"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="PromoDateStart"
HeaderText="Promo Date Start"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="ItemID2"
HeaderText="Item ID"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemBrand"
HeaderText="Item Brand"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemCategory"
HeaderText="Item Category"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemShortDesc"
HeaderText="Item Short Description"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemLongDesc"
HeaderText="Item Long Description"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemCondition"
HeaderText="Item Condition"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemOffer"
HeaderText="Item Offer"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="ItemPrice"
HeaderText="Item Price"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="MydItemId"
HeaderText="Mydin Item ID"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="MydSupplierID"
HeaderText="Mydin Supplier ID"
ReadOnly="false"
Visible="True"/>
<asp:ButtonColumn
ButtonType="PushButton"
CommandName="Delete"
HeaderText="Delete Item"
Text="Delete"
Visible="True"/> </Columns>
</aspataGrid>
<p></p>
<p> </p>
</form>
</body>
</html>
</font id=code></pre id=code>
Edited by - alhariz on 02 Apr 2004 06:31:17