Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Data not display when klick swicth category

  Asked By: Arland    Date: Apr 03    Category: Asp.net    Views: 5481

i any problem in myscript, data not display when klick swicth kategori,
thereabouts where problem's my script
script :

<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">

Sub Getkategori_Click(Sender As Object, E As EventArgs)

Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

Dim SelectCommand As String = "select * from buku where kategori =

MyCommand = New SqlDataAdapter(SelectCommand, MyConnection)

MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@kategori",
SqlDbType.NVarChar, 2))
MyCommand.SelectCommand.Parameters("@kategori").Value = Myselect.Value

DS = new DataSet()
MyCommand.Fill(DS, "buku")

End Sub

<body style="FONT: 10pt verdana">
<form runat="server">
<h3><font face="Verdana">Buku Per Kategori</font>
Select a Kategori:
<select id="MySelect" runat="server">
<option>Novel Lokal</option>
<option>Novel Import</option>
<option>Dunia Usaha</option>
<input type="submit" value="Kategori" runat="server"
onserverclick="getkategori_click" />
<ASP:DataGrid id="MyDataGrid" runat="server"
EnableViewkategori="false" HeaderStyle-BackColor="#6699ff" Font-Size="8pt"
Font-Name="Verdana" CellSpacing="0" CellPadding="3" ShowFooter="false"
BorderColor="black" BackColor="#ccccff" Width="700"></ASP:DataGrid>



6 Answers Found

Answer #1    Answered By: Wilfred Young     Answered On: Apr 03

The DS object  is filled properly by Fill method ?

Answer #2    Answered By: William Bouchard     Answered On: Apr 03


<asp:DropDownList id="MySelect" runat="server" >
<asp:ListItem>Novel Lokal</asp:ListItem>
<asp:ListItem>Novel Import</asp:ListItem>
<asp:ListItem>Dunia Usaha</asp:ListItem>
<asp:Button Text="Kategori" runat="server" onclick="getkategori_click"

Answer #3    Answered By: Jean Bell     Answered On: Apr 03

The value of 2 of the parameter's width is correct ?
Try and put a breakpoint in script function and run in debug mode... to see
what's happening.
The IDE allows you to debug the scripts.

Answer #4    Answered By: Dominic Murphy     Answered On: Apr 03

I have a question How are you reading the value
of the selected ListItem? In your Getkategori_Click()
event handler you need to access the Request
object to get the value of the MySelect.SelectedItem.Text
or something similar to pass to @kategori and make your
query work.

Answer #5    Answered By: Jeffrey Washington     Answered On: Apr 03

if anybody knows answer for this question please send
it to quickly

1.How would you get ASP.NET running in Apache web
servers - why would you even do this?

2.what is meant by Line Item dimension?

Answer #6    Answered By: Landra Schmidt     Answered On: Apr 03

1. Yes you can

2. www.dmreview.com/article_sub.cfm?articleId=7844

I see a lot of google in your future...

Didn't find what you were looking for? Find more on Data not display when klick swicth category Or get search suggestion and latest updates.