Results 1 to 5 of 5

Thread: RESOLVED[02/03] big datagrid problem for web application

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    790

    RESOLVED[02/03] big datagrid problem for web application

    Currently, I have a static datagrid on a webapplication. I was doing some research and it seems there are no pointers on this datagrid .I have multiple records been shown in the grid from a SQL query from time to time instead of a single record. And when either result occurs in the grid, I want to go the next page when I press a button.

    I want my information from the grid to show up in textboxes on the next page when I do a Server.transfer(""). However, I want the grid to be selectable so that whatever row is selected that the items in the grid row selected appear in the next page's textboxes. The best I have found is to play with the grid color to highlight in yellow during onclick which looks like this:
    Code:
     Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
           
            If (e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer) And _
            (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then
                e.Item.Attributes.Add("onClick", "this.style.backgroundColor='Yellow'; this.style.color='Black'")
                If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Gainsboro'; this.style.color='Black'")
            End If
            If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer And e.Item.ItemType = ListItemType.Item Then
                e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'; this.style.color='Black'")
                If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Whitesmoke'; this.style.color='Black'")
            End If

    Then I would store the values here:

    Code:
     Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnOpen.Click
    
           
    
                context.Items("Storage1") = DataGrid1.Items(0).Cells(0).Text
                context.Items("Storage2") = DataGrid1.Items(0).Cells(1).Text
                context.Items("Storage3") = DataGrid1.Items(0).Cells(2).Text
                context.Items("Storage4") = DataGrid1.Items(0).Cells(3).Text
                context.Items("Storage5") = DataGrid1.Items(0).Cells(4).Text
                Context.Items("Storage6") = DataGrid1.Items(0).Cells(5).Text
               
    
    
            Server.Transfer("Verify_Iss.aspx")
    and then by the next page verify.aspx do the following:
    Code:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            If Not IsPostBack Then
                TextBox1.Text = Context.Items("Storage1")
                TextBox2.Text = Context.Items("Storage2")
                TextBox3.Text = Context.Items("Storage3")
    
    end if
    Right now it just takes the first row from the grid and that 's it on how it is written currently.
    Last edited by Christopher_Arm; Oct 19th, 2007 at 09:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width