menu1 Idsinde menu , dtlist IDsinde datalis ve rptPages Idsinde repeaterım var
şu kodlarla menuyü dolduruyorum
Private Function GetMenuData() As DataTable
Dim selectCommand As String = "SELECT CategoryId,ParentId,Name FROM Categories"
Dim conString As String = WebConfigurationManager.ConnectionStrings("sqldata").ConnectionString
Dim dad As SqlDataAdapter = New
SqlDataAdapter(selectCommand, conString)
Dim dtblCategories As DataTable = New
DataTable()
dad.Fill(dtblCategories)
Return
dtblCategories
End
Function
Private Sub AddTopMenuItems(ByVal menuData As DataTable)
Dim view As DataView = New DataView(menuData)
view.RowFilter = "ParentID IS NULL"
Dim row As DataRowView
For Each row In view
Dim NewMenuItem As MenuItem = New MenuItem(row("Name").ToString(), row("CategoryId").ToString())
Menu1.Items.Add(NewMenuItem)
AddChildMenuItems(menuData, NewMenuItem)
Next
End
Sub
Private Sub AddChildMenuItems(ByVal menuData As DataTable, ByVal parentMenuItem As
MenuItem)
Dim view As DataView = New
DataView(menuData)
view.RowFilter =
"ParentID="
+ parentMenuItem.Value
Dim row As
DataRowView
For Each row In
view
Dim NewMenuItem As MenuItem = New MenuItem(row("Name").ToString(), row("CategoryId"
).ToString())
parentMenuItem.ChildItems.Add(NewMenuItem)
AddChildMenuItems(menuData, NewMenuItem)
Next
End
Sub
şu kodlarla datalisti dolduruyorum
Private Sub
Yukle()
TrySayfa =
New PagedDataSource
Dim DataTable As New DataTable
Baglanti =
New
SqlConnection
Baglanti.ConnectionString =
"Data Source=72.0.0.0.;Initial Catalog=denme;Persist Security Info=True;User ID=xlxl;Password=018645"
If Baglanti.State = ConnectionState.Closed Then Baglanti.Open()
command =
New
SqlCommand
command.Connection = Baglanti
Dim a As
String
a = Menu1.Controls.Item
command.CommandText = "SELECT * FROM Products where CategoryId=" & a & ""
Dim rs As SqlDataAdapter = New SqlDataAdapter(command)
rs.Fill(DataTable)
Baglanti.Close()
Sayfa.DataSource = DataTable.DefaultView
Sayfa.AllowPaging =
True
Sayfa.PageSize = 6
SayfaSayisi = Sayfa.PageCount - 1
Sayfa.CurrentPageIndex = SayfaNo
dtlist.DataSource = Sayfa
dtlist.DataBind()
ReadSayfa()
Catch ex As
Exception
Baglanti.Close()
End
Try
End
Sub
sorun şu : yazı boyutu büyük ve rengi kırmızı olan yerde menudeki categoryıdyi alıp hemen altındaki kodda select işleminde kullanmaya çalışıyorum. fakat hata vermiyor ama menude herhangibir alana tıkladığımda listeleme yapmıyor.
sizce sorun nerde?