Postback data

T

Tuðrul ARAS

Hi friends,

I Have a datagrid. It's for list for categories.
I want this list is hyperlink and for postback send Categoriesid. User click
this categorie list link and user see list of sub categories.

My datagrid :
*********************************
<asp:DataGrid id="DGKategori" style="Z-INDEX: 101; LEFT: 96px; POSITION:
absolute; TOP: 48px"
runat="server" Width="568px"
AutoGenerateColumns="False"
DataKeyField="katid"
OnItemCommand="altkategori">
<Columns>
<asp:BoundColumn DataField="katadi"
HeaderText="Kategori"></asp:BoundColumn>
<asp:ButtonColumn Text="Daha Alt Kat" DataTextField="katadi"
HeaderText="Alt Kategori"></asp:ButtonColumn>
</Columns>
****************************************
Code
****************************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strbaglan, strSql As String
strbaglan = "Provider=Microsoft.Jet.Oledb.4.0;Data
Source=C:\Inetpub\wwwroot\Kategori\db2.mdb"
strSql = "SELECT * FROM kategori WHERE parent=0"
Dim baglan As New OledbConnection(strbaglan)
baglan.open()
Dim dsRef As New DataSet

Dim AdpTum As New OleDbDataAdapter(strSql, baglan)
AdpTum.Fill(dsRef, "kategori_list")

DGkategori.DataSource = dsRef.Tables("kategori_list").DefaultView
DGKategori.DataBind()
End Sub

Sub altkategori(ByVal source As Object, _
ByVal e As DataGridCommandEventArgs)
Response.Write(e.Item.DataItem) 'I want in here postback for katid
End Sub
 
V

Volkan Karaboða

may be that code helps to you

Private Sub grid_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grid.ItemCommand

If e.CommandName = "katid" Then

Response.Redirect("../list.aspx?katidID=" & e.Item.Cells(?).Text)

End If

End Sub
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top