Postback data

Discussion in 'ASP .Net Datagrid Control' started by Tuðrul ARAS, Feb 6, 2004.

  1. Tuðrul ARAS

    Tuðrul ARAS Guest

    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
     
    Tuðrul ARAS, Feb 6, 2004
    #1
    1. Advertising

  2. 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







    "Tuðrul ARAS" <tugrul(at)gawab.com> wrote in message
    news:...
    > 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
    >
    >
     
    Volkan Karaboða, Feb 20, 2004
    #2
    1. Advertising

  3. sorry I for got to say you should use a button column to do this...


    "Tuðrul ARAS" <tugrul(at)gawab.com> wrote in message
    news:...
    > 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
    >
    >
     
    Volkan Karaboða, Feb 20, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Psych971
    Replies:
    5
    Views:
    4,636
    bruce barker
    Dec 17, 2004
  2. =?Utf-8?B?Q2hhZA==?=

    Postback not being set to True on first postback

    =?Utf-8?B?Q2hhZA==?=, Apr 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    512
    =?Utf-8?B?Q2hhZA==?=
    Apr 4, 2005
  3. gce
    Replies:
    2
    Views:
    1,725
  4. Jacky Chau
    Replies:
    2
    Views:
    2,072
    Ninjamyst
    Jun 8, 2005
  5. Fabio Mastria
    Replies:
    5
    Views:
    4,367
    TechMCAD13
    Jan 30, 2008
Loading...

Share This Page