CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 11/28/2005 6:52:21 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
taihon64
Asp.Net User
Problems of "Inherit DataGrid"...(With sourcecode)11/28/2005 6:52:21 AM

0/0

Hi All,

I made a custom server control that inherit DataGrid to expand some functions (include onMouseover highlight , onClick then highlight the selected row..).
Now I got some problems. When I build the control and use it in my web form. It does not support all the attributes of  datagrid in VS.NET Web form html editor.

Although it does not support, but it can work when I manually add the codes in the editor just like below

<cc1:powergrid id="PowerGrid1" runat="server" Back_Color="#FFFFC0" MouseOver_Color="Green" SelectColor="#66CCCC" BackColor="#FFFFC0" SelectedIndex="0">
            <Columns>
            </Columns>
               ..........................................
</cc1:powergrid>

Here is my sourcecode of the control :I hope someone could resolve my problems.

Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Drawing
Imports System.Drawing.Color

<DefaultProperty("Text"), ToolboxData("<{0}:PowerGrid runat=server></{0}:PowerGrid>")> _
Public Class PowerGrid
    Inherits System.Web.UI.WebControls.DataGrid
    Private _text As String
    Private _SelectColor As String
    Private _MouseOverColor As String
    Private m_LastE As System.Web.UI.WebControls.DataGridItemEventArgs
    Private m_intRecordsPerRow As Integer = 1
    Private s_index As Integer
    Sub New()

    End Sub

    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
        Get
            Return _text
        End Get

        Set(ByVal Value As String)
            _text = Value
        End Set
    End Property
    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [SelectColor]() As String
        Get
            Return _SelectColor
        End Get
        Set(ByVal Value As String)
            _SelectColor = Value
        End Set
    End Property

    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [MouseOver_Color]() As String
        Get
            Return _MouseOverColor
        End Get
        Set(ByVal Value As String)
            _MouseOverColor = Value
        End Set
    End Property

    Public Overrides Property SelectedIndex() As Integer
        Get
            Return s_index
        End Get
        Set(ByVal Value As Integer)
            s_index = Value
        End Set
    End Property
    Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
        MyBase.Render(output)
        Me.Page.RegisterHiddenField("SelectItem", "")
    End Sub

    Private Sub WebCustomControl1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles MyBase.ItemCreated
        Select Case e.Item.ItemType
            Case ListItemType.SelectedItem, ListItemType.Item, ListItemType.AlternatingItem
                e.Item.Attributes.Add("onmouseup", "this.style.backgroundColor='" + _SelectColor + "'")
                e.Item.Attributes.Add("onclick", "javascript:document.Form1.SelectItem.value='" & e.Item.ItemIndex & "';document.Form1.submit();")
                If e.Item.ItemIndex = Me.SelectedIndex Then
                    e.Item.Attributes.Remove("style")
                    e.Item.Attributes.Add("style", "background-color:" + _SelectColor + ";")
                Else
                    e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='" + _MouseOverColor + "';this.style.cursor='hand';")
                    If Me.BackColor.Name = "0" Then
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#000000';")
                    Else
                        Dim color As String = Me.BackColor.Name
                        If color.Substring(0, 2) = "ff" Then
                            color = "#" + color.Substring(2, 6)
                        End If
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color + "';")
                    End If
                End If
        End Select

    End Sub

    Protected Overrides Sub Oninit(ByVal e As System.EventArgs)

        If Me.Page.Request("SelectItem") <> "" Then
            s_index = CInt(Me.Page.Request("SelectItem"))
        Else
            s_index = -1
        End If

    End Sub
End Class


1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
IIS 6: The Complete Reference Authors: Hethe Henrickson, Scott Hofmann, Pages: 720, Published: 2003
ASP.NET Data Web Controls Kick Start: Kick Start Authors: Scott Mitchell, Pages: 432, Published: 2003
Programming Visual Basic .NET Authors: Jesse Liberty, Dave Grundgeiger, Pages: 541, Published: 2003
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Programming ASP.NET: Building Web Applications and Services Using C and VB.NET. Authors: Jesse Liberty, Dan Hurwitz, Pages: 988, Published: 2003
Visual Basic.NET Unleashed Authors: Paul Kimmel, Pages: 784, Published: 2002
Building Web Solutions with ASP.NET and ADO.NET Authors: Dino Esposito, Pages: 379, Published: 2002
Microsoft Sharepoint: Building Office 2007 Solutions in VB 2005 Authors: Scot P. Hillier, Pages: 519, Published: 2007
Building E-commerce Sites in the .NET Framework Authors: Jason Bentrum, James Whatley, Pages: 538, Published: 2001

Web:
CodeProject: Printing with a custom DataGrid. Free source code and ... NET inheriting from class System.Windows.Froms.DataGrid to implement an ..... i want to use the above code to print a datagrid. Normally no problem, but my ...
CodeProject: Extending the default DataGrid (ASP.NET 1.1). Free ... WebControls Public Class CustomdataGrid Inherits DataGrid End Class ..... If you have any any other questions/problems fell free to post. ...
[#SDK-12647] DataGrid should not Inherit dataChangeEffect - Adobe ... Actual Results: DataGrid inherits dataChangeEfffect ... Doc does not modify source code, so back to internal review. [ Show ยป ] ...
CodeProject: Better DataGrid Column Header ToolTips. Free source ... DataGrid to utilize this text property. So I create a class called CustomDataGrid which inherits System.Web.UI.WebControls.DataGrid and overrides the ...
Source Code & Conclusion - Selecting, Confirming & Deleting ... Page //Inherit Page Class { protected System.Web.UI.WebControls.DataGrid MyDataGrid; ...... Problem in update Records when i search Record in datagrid ( new) ...
Visual Basic.NET (VB.NET) Source Code: Host DateTimePicker in a ... NET) Source Code Host DateTimePicker in a DataGrid Column - which is well commented ... Keywords, DataGridColumnStyle, derive, inherit, DataGridTextBoxColumn ...
ASP.NET.4GuysFromRolla.com: Creating a Row-Selectable DataGrid Control Examining the Client-Side Source Code The DataGrid Web control renders as an HTML ... we can create a class that inherits the DataGrid class. ...
Cutting Edge: Moving DataGrid Rows Up and Down If you want alternate row coloring you'd be better off using DataGrid styles today. (The original RowOver source code dates back to late 1999, before ASP. ...
Building a Full-Featured Custom DataGrid Control Once you run the application and view the page's source code, our client-block code ..... public class myCustDG : DataGrid { //Inherits the DataGrid Class ...
CodeGuru: Print Support in a Custom DataGrid Control NET inheriting from the class System.Windows.Forms.DataGrid to implement an ... Modifications in source code for other DataSource objects would not be very ...




Search This Site:










overriding module usercontrols

premium modules vs non premium modules

large website and urlcontrol

the profile provider appears useless for me...=(

maintaining treeview state across postbacks?

mixing forms and windows authentication

apparent remote debugging bug

allow login page and one other specified page for browsing

can't edit item template in details view

dnn labels not pickup local .resx 's text values

cannot connect to localhost/dotnetnuke while connected to internet

logging in resulting in error: 500

norton internet security 2005 interferes with visual studio 2005 (it hangs visual studio)

what e-commerce store will work with verisign?

treeview

just upgraded local version 2.0.4 to 2.1.2 - all works except custom module

problem with passing the text box value when using master page

in table control i want fixed height and width

activedirectorymembershipprovider - does this actually work?

how to best limit list of available modules

4get password

registerhiddenfield within master page

encrypting the connectionstring

how to email new registration to non-administrator

dynamic masterpage?

webhost4life & flash remoting

authorization without using session

which permissions does compositecontroldesigner need?

gage dnn knowledge - hiring a dnn developer

unauthorised access

 
All Times Are GMT