Custom Datagrid: Doesn't display and doesn't work

Hi all,

Hope someone can share their experience! I am trying to make a custom datagrid, only in appearance for now. Results:

1. On dragging the control from the VS toolbox: get a grey rectangle, not the table like look.
2. On running the Web page: no HTML.

<code>
Imports System.ComponentModel
Imports System.Web.UI.WebControls
Imports System.Web.UI

<DefaultProperty("Text"), ToolboxData("<{0}:custDG runat=server></{0}:custDG>")> Public Class custDG
    Inherits DataGrid

    Public Sub New()
        Me.BorderColor = Drawing.Color.Chartreuse
        Me.BorderStyle = BorderStyle.Double
    End Sub

    ' VS generated. MSDN states these are for internal purposes.
    Protected Overrides Sub CreateControlHierarchy(ByVal useDataSource As Boolean)

    End Sub

    ' VS generated.
    Protected Overrides Sub PrepareControlHierarchy()

    End Sub

End Class

For a comparison, I successfully made a customised listbox - just cosmetic customisations. VS did not supply an generated code for this.

<code>
Imports System.ComponentModel
Imports System.Web.UI

<DefaultProperty("Text"), ToolboxData("<{0}:lstbox runat=server></{0}:lstbox>")> Public Class lstbox
    Inherits System.Web.UI.WebControls.ListBox

    Public Sub New()
        Me.BackColor = Drawing.Color.Black
        Me.BorderStyle = WebControls.BorderStyle.Dotted

    End Sub

End Class
</code>

Is there something different about the DataGrid? Hope someone can shed some light on this.

Thanks.
0
bluekiwi
3/4/2006 1:55:45 PM
asp.net.custom-server-controls 3498 articles. 0 followers. Follow

1 Replies
1265 Views

Similar Articles

[PageSpeed] 52

Some success....

Make two .dll's, one for the custom DataGrid control, the other, data access code. If I want to specify a stored procedure dynamically (on the fly), I have to put the data access code in a seperate .dll. The DataGrid class doesn't like having the code of function "getData" as it written, specifically this line: da.SelectCommand.CommandText = sproc.

So I have a drag n drop, custom look DataGrid with re-usable code for data access that takes any sproc.

One
----
Imports System.Web.UI.WebControls
Public Class custDG
    Inherits DataGrid

    Public Sub New()

        Me.BackColor = Drawing.Color.Cornsilk
        Me.BorderStyle = BorderStyle.Double
        Me.BorderColor = Drawing.Color.Aqua

    End Sub
End Class

Two
----
Imports System.Data.SqlClient
Public Class codeForCustomDG

    Public Function getData(ByVal sproc As String) As DataSet

        Dim ds As New DataSet
        Dim da As New SqlDataAdapter

        da.SelectCommand = New SqlCommand
        da.SelectCommand.CommandText = sproc
        da.SelectCommand.CommandType = CommandType.StoredProcedure
        da.SelectCommand.Connection = New SqlConnection("data source=(local);integrated security=true;initial catalog=Northwind")
        da.Fill(ds, "employees")

        Return ds

    End Function

End Class

In the Web form
-----------------

Dim cda As New codeForCustomDG
Me.CustDG1.DataSource = cda.getData("dbo.showEmployees")
Me.CustDG1.DataBind()
0
bluekiwi
3/5/2006 2:43:34 PM
Reply:

Similar Artilces:

Repeater Containing Custom Control Doesn't Work With Page ViewState On Unless I Don't ReBind...
I have create a custom composite drop down list control that does not save view state for all properties.  There is a requirement that this contol work in a Repeater.  I have tested the contol in a repeater in various ways.  This is my first post ever, so I apologive if I have provided too little, too much or the wron info. Note: The Repeater was always created in the aspx file.  1) Page.EnableViewState = true , and my control added to the repeater programmatically via the ItemDataBound event. 2) Page.EnableViewState = false, and my control added to the repea...

Urgent: AutoCompleteExtender doesn't work/Updatepanel doesn't work
This is my code for the AutoCompleteExtender <asp:textbox id="txtQuickSearch" runat="server" CssClass="inputText" style="width:145px; "></asp:textbox> <atlas:AutoCompleteExtender runat="server" ID="acSearch"> <atlas:AutoCompleteProperties TargetControlID="txtQuickSearch" Enabled="True" ServicePath="http://localhost/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx" ServiceMethod="GetAllModels" minimumprefixlength="2" /> </atlas:AutoCompleteExtender> When i start typing fiddler shows: # Result Host URL Body Caching Content-Type User-...

Spellchecker doesn't work: no error, just doesn't work
Hey all. This is only happening with one person. It's all GW7 no SP. has worked fine before. Anyway when they type along it doesn't catch that spelling and it doesn't fire up spell check before it's sent like it is checked off to do. It does nothing. It just sends it when you click send; no error, nothing. I did a rebuild, analyze/fix. I have it set at all levels for this user. any ideas Mark, well, I'd try a more recent client version first. GW7 was less than stellar before SP1. Uwe -- Novell Support Connection Volunteer SysOp Please don...

Freenx doesn't work, NX doesn't work with compiz. Questions
FreeNX just doesn't work. NX from nomachine installed well, but I guess that limits me to two logins? NX doesn't work with compiz, tho, at least from machines not running compiz. So no great surprise. :-) Is there any way to run startkde that disables compiz and uses kwin? Alternatively, hows the easiest way to handle alternative logins? I could link the two documents folders together, but then I'd have problems with file permissions. I'm just looking for ideas here, I could live with two logins. -- dougnc -------------------------------------------...

Filter's rule that matches custom header doesn't work for incoming messages and 'Run filters on Message'
Hi! I have filter with rule X-Bugzilla-Status is NEW and it matches _only_ when I choose 'Run filters on Folder'. It does _not_ match incoming messages and when I choose 'Run filters on Message'. 'Apply filter when:' is set to 'Checking Mail or Manually Run'. It's IMAP account and I'm running TB 5.0. Could someone please confirm this? Is there a bug for this already? rkent on #maildev irc channel pointed me to this bug https://bugzilla.mozilla.org/show_bug.cgi?id=363238 ...

Summary Validation Doesn't work for Custom Vlidation Control ,Server side validation
I have many validation controls, one of which is custom validation control. All the validation controls run on client side show proper validation summary message. But for Custom validation control, the validation summary doesn't show anything which runs on server side. Why? My sample code is as follow.protected void CusValSponsorName_ServerValidate*object source, ServerValidateEventArgs args*    {        string[] names = sd.getSponsorName("Select SponsorName from Sponsor");        foreach *string name in nam...

keeps making me download update, but, update doesn't work, makes me download update, update doesn't work..................
Name: donald davis Email: galenachefatyahoodotcom Product: Firefox Summary: keeps making me download update, but, update doesn't work, makes me download update, update doesn't work.................. Comments: That's pretty much the whole deal. An update screen pops up, I update, the update doesn't take and the next time I use firefox mozilla the same thing happens over and over and over. Thanks Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.4 ...

'Tab' control 's visible doesn't work.Why?
I use tab control in my applition. And I set visible=false, but it doesn't work. my code is: ----------------------------------------------- <asp:ScriptManager ID="ScriptManager1" runat="server" />  <div>   <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="138px" ActiveTabIndex="0"    Width="402px">    <ajaxToolkit:TabPanel runat="server" ID="Panel1" HeaderText="Tab1" Visible="f...

Installation 'Sybase DataWindow PS' printer on W98 doesn't work (so PDF export can't work either)
I have a problem with export DataWindow content to PDF on W98 systems. (I don't have any problem with PDF export on other systems like as WINNT, W2K, WXP). I found out that the problem is in the Sybase DataWindow PS printer. It looks like installed but it DOESN'T WORK on W98. When I try print something on this printer then no PostScript file is created. So I tried manual installation of it but it occurs an error during manual installation (I used description of instalation from Bruce Armstrong). The error said that printer driver (PSCRIPT.DLL) can't be loaded. I use...

Can't get the Web Controls to work.. The Build.Bat file doesn't work? HELP>> ARGGG>.
Hi.. I was wanting to use the IE Web Controls, the Tab Strip, etc, and play with it.. Since I have IIS 5, I thought I'd copy them there using the Read me.txt instructions and then copy to a dev server that I use at a web host.. Well, everything worked except the Build file doesn't build the Microsoft.UI.Webcontrols.DLL file? When I try to run it by double clicking on it, it runs really fast in  the DOS window, but I can't see what it says and it closes.. So I tried to do so manually and I received an error that the "cse.exe is not recognized as an internal or external command or batch...

<location> doesn't work when parent directory of path doesn't exist
Hi, I'm having a problem setting up web.config to challenge for authentication on some pages, but not others. Here is what I'm doing:<configuration>...    <system.web>...        <authentication mode="Windows" />        <authorization>            <allow users="*"/>        </authorization>...    </system.web>    <location path="se...

Menu doesn't display 1st item and trimming isn't working`
Hi there,I have created a menu using a sitemap.Problem is that I want the 1st value to be "Home" and have a link to my home page but it doesn't work. This is my sitemap.I also have trimming enable on my web.config yet when I load the site I am able to see menus when I don't have access them....whenever I click on the menu I get redirected to the login page but I don't want to be able to see them if I don't have access. My webconfig is below. <?xml version="1.0" encoding="utf-8" ?><siteMap>    <siteMapNode title="Default" description="Home"  roles="*" u...

Keyboard shortcut 'ctrl+T' doesn't always work
Name: Georgi Liubenov Email: liubenoffatmaildotbg Product: Firefox Summary: Keyboard shortcut 'ctrl+T' doesn't always work Comments: When pdf document is opened in a tab 'ctrl+T' shortcut doesn't work. I have to go to File -> New Tab to open a tab. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to ...

Deriving custom control from UpdatePanel doesn't work
I previously created multiple controls by deriving them from UpdatePanel using ATLAS (before BETA).   Today I tried switching one of the controls to BETA and now I am getting PageRequestManagerParserErrorException error.I created a very simple control to reproduce the problem:===================================namespace AtlasControls{    [ToolboxData("<{0}:TestAtlasCtrl runat=server></{0}:TestAtlasCtrl>")]    public class TestAtlasCtrl : UpdatePanel, INamingContainer    {        public TestA...

Web resources about - Custom Datagrid: Doesn't display and doesn't work - asp.net.custom-server-controls

Resources last updated: 1/15/2016 12:02:20 PM