Can we create dyamic GridView?

Last post 05-05-2008 8:21 AM by 5ugeng. 2 replies.

Sort Posts:

  • Can we create dyamic GridView?

    05-03-2008, 8:34 AM
    • Member
      61 point Member
    • 5ugeng
    • Member since 04-01-2008, 7:54 AM
    • Surabaya
    • Posts 62

    Hello Everybody,

    i have a gridview control n i display the select command, but it's not dynamic grid view because i must select row first then i know the row is selected..

     

    I want to ask how to create dynamic gridview but not use select command, Example i click the column of the row and the program know the index or maybe

    the datakey but not use select command...

     

    Please help me, Thank you...
     

  • Re: Can we create dyamic GridView?

    05-03-2008, 2:02 PM
    • Member
      260 point Member
    • ferrymeidianto
    • Member since 12-09-2007, 7:06 PM
    • Indonesia
    • Posts 62

    Hi,

    This is a feature that is not supported by default ASP.NET GridView.

    You can take advantage of this feature on commecial grids (like telerik and componentArt does).

    If you want to create it by yourself, I suggest to use Repeater instead and put javascript function (for each row) to get the clicked index or key.

    I hope you get the idea.

    Thanks.

    Ferry

    Please "Mark as Answer" if this post answers your question.

    Ferry Meidianto
    www.meidianto.com
  • Re: Can we create dyamic GridView?

    05-05-2008, 8:21 AM
    Answer
    • Member
      61 point Member
    • 5ugeng
    • Member since 04-01-2008, 7:54 AM
    • Surabaya
    • Posts 62

    Sorry, I try hard to create a dynamic grid view and i success with the injection of javascript in gridview..

    The code is this :

      Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
            If e.Row.RowType = DataControlRowType.DataRow Then
                e.Row.Attributes("onmouseover") = "this.style.cursor='hand';this.style.textDecoration='underline';"
                e.Row.Attributes("onmouseout") = "this.style.textDecoration='none';"

                e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackEventReference(sender, "Select$" + e.Row.RowIndex.ToString)         
            End If
        End Sub

    That;s work without using select command.

    Thanks for the reply 

Page 1 of 1 (3 items)