DataGrid双击行事件

 <asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 40px" runat="server"
     BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" BackColor="#DEBA84" CellPadding="0"
     Width="272px">
     <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#738A9C"></SelectedItemStyle>
     <ItemStyle ForeColor="#8C4510" BackColor="#FFF7E7"></ItemStyle>
     <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#A55129"></HeaderStyle>
     <FooterStyle ForeColor="#8C4510" BackColor="#F7DFB5"></FooterStyle>
     <PagerStyle HorizontalAlign="Center" ForeColor="#8C4510" Mode="NumericPages"></PagerStyle>
    </asp:datagrid>
    <DIV style="DISPLAY: inline; Z-INDEX: 104; LEFT: 168px; WIDTH: 24px; POSITION: absolute; TOP: 360px; HEIGHT: 16px"
     ms_positioning="FlowLayout">ÐÐ</DIV>
    <INPUT id="Hidden1" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 8px" type="hidden"
     name="Hidden1" runat="server"></FONT>
   <asp:TextBox id="TextBox1" style="Z-INDEX: 103; LEFT: 128px; POSITION: absolute; TOP: 360px"
    runat="server" Width="32px"></asp:TextBox>
   <asp:Label id="Label1" style="Z-INDEX: 105; LEFT: 40px; POSITION: absolute; TOP: 360px" runat="server">ÄúË«»÷Á˵Ú</asp:Label>

   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            Dim d As New Data
            DataGrid1.DataSource = d.getTable
            DataGrid1.DataBind()

        End If
        If Not Request.Form("hidden1") Is Nothing Then
            TextBox1.Text = Request.Form("hidden1").ToString
        End If
    End Sub

    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 Then
            'Response.Write(Color.Beige.ToString())
            'e.Item.Attributes("id") = e.Item.ItemType.ToString() e.Item.ItemIndex.ToString()
            e.Item.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#FFF7E7';this.style.color='#8C4510'")
            e.Item.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#A55129';this.style.color='white';this.style.cursor='hand';")
            e.Item.Attributes.Add("Ondblclick", "javascript:setv(" e.Item.Cells(0).Text ")")
        End If
    End Sub
End Class

posted @ 2005-03-15 15:43  PointNet  阅读(1238)  评论(0编辑  收藏  举报