CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 11/8/2005 1:38:22 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 105 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
yceron
Asp.Net User
Problem with databound composite control11/8/2005 1:38:22 PM

0

I'm developing an ASP.NET 1.1 composite control with a datalist.  The
datalist contains a template with some textboxes and some labels.  The
datalist template part i got working fine.
My problem is with the Postback.  I've tried different things that i
have seen on different articles and tutorials without any results.
The closer i've gotten to what I need is the implementation in the code
provided below.
The postback is working ok (I'm getting the information i update in the
webpage, instead of what came initially from the database).  But the
problem is that the only way i've gotten it to "work" is by going
database AGAIN after postback in order to get populate the datalist.

Can anyone give me some help with this?  I've been working with this
problem for over 2 weeks now, without any good results :(
What am I doing wrong?  What am I missing?

Thanks in advanced.

Yolanda

----------------------
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls

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

        Dim _text As String
        Dim _connectionString As String
        Dim _repeatColumns As Integer
        Dim dlInformation As DataList

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

            Set(ByVal Value As String)
                _text = Value
            End Set
        End Property
        <Bindable(True), Category("Appearance"), DefaultValue(3)>
Property [RepeatColumns]() As Integer
            Get
                EnsureChildcontrols()
                Return _repeatColumns
            End Get

            Set(ByVal Value As Integer)
                _repeatColumns = Value
            End Set
        End Property

        Protected Overrides Sub CreateChildControls()
            CreateControlHierarchy()

        End Sub

        Private Sub CreateControlHierarchy()
            Dim itemTemplate As New gridItemTemplate(_imagePath)

                Controls.Clear()
                dlInformation = New DataList
                dlInformation.ID = "dlInfo"
                dlInformation.RepeatColumns = _repeatColumns
                itemTemplate.InstantiateIn(dlInformation)
                dlInformation.ItemTemplate = itemTemplate

                Me.Controls.Add(dlInformation)
                Me.DataBind()

        End Sub

        Private Function getDataSource() As DataTable
                'Goes to the database and fetches a datatable with the
information i need
                '..........
        End Function

        Public Overrides Sub DataBind()

            Me.dlInformation.DataSource = getDataSource()
            MyBase.DataBind()

        End Sub
    End Class

----------------------

MattDot
Asp.Net User
Re: Problem with databound composite control11/10/2005 12:59:30 AM

0

<p>The way most controls solve this problem is to store the number of records you bound to your datalist in ViewState.</p><p> For example, say you have 5 records in your data source. Create some code to create a "dummy datasource" like a datatable with 5 empty rows (but the right columns). On PostBack, bind to your "dummy datasource" instead of going back to the DB.
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Microsoft Visual C# 2005 Unleashed Authors: Kevin Hoffman, Pages: 692, Published: 2006
Developing Microsoft ASP.NET Server Controls and Components Authors: Nikhil Kothari, Vandana Datye, Pages: 689, Published: 2002
ASP.NET AJAX Programming Tricks Authors: Matthew David Ellis, Pages: 388, Published: 2007

Web:
ASP.NET Resources - Building a Composite Databound Control the 2.0 Way Building a Composite Databound Control the 2.0 Way ... (running on Mono) ad noticed that the same problem described in 'Order of control population matters' ...
A Crash Course on ASP.NET Control Development: Building Composite ... NET 2.0, most of the boilerplate code required for a full implementation of realistic and data-bound composite controls—the previous were just toy ...
Composite controls that do their own databinding - Andy Smith's Blog So the control dev needs to databind during load in both first-request and disabled-viewstate states. This mostly solves the problem; however there is one ...
Problem with databound composite control - ASP.NET Forums Problem with databound composite control. Last post 11-09-2005 7:59 PM by MattDot. 1 replies. Sort Posts: Oldest to newest, Newest to oldest ...
ASP.NET 2.0 Training : Data Bound Controls In this tutorial you will learn about Data Bound Controls - The Hierarchy of Data Bound Controls, Simple Data Bound Controls, Composite DataBound Controls ...

Problem with databound composite control - ng.asp-net-forum ... Problem with databound composite control, > ROOT > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum, Date: 11/8/2005 1:38:22 PM, Replies: 1, ...
How to choose between overriding DataBind() or OnDataBinding ... Problem with databound composite control - ng.asp-net-forum ... How to choose between overriding DataBind() or OnDataBinding . ...
DataBoundControl - ng.asp-net-forum.windows-hosting_open_forum A composite server control is a control that is implemented from a ... NET Resources - Building a Composite Databound Control the 2.0 Way Building a ... problem making usercontrol, do i need a custom event here? ...
Building a data-bound Templated Control - ng.asp-net-forum.windows ... NET Server Controls, I created a non-databound templated control that displayed ... composite control simple custom property problem · wizard control ...
DataGrid PageIndexChanged event does NOT fire inside dynamically ... DataBind() method MUST be called in the Page_Load() method of the user control ( ascx .... composite control - design-time problems with label - vs 2003 ...






isobject() in aspx

is plain asp still being developed?

working with dim

getting web.config settings in old asp

do until from access to asp.net

connecting to old asp xml 'page'

help with using data

is it possible to include classic asp files in aspx pages?

how to use .asp file from .aspx file ?

migrating asp to asp.net 2.0 - global variables

migration from asp to asp.net issues

using a contect page to view a classic asp page?

join authentication for asp asnd asp.net application

asp.net to win.net migration

accessing com through interop problem

asp.net 2.0 - design issue?

problem during convertion from asp to aspx

passing data from asp.net to asp classic

asp page using asp.net dll

question: asp page running on vs.net 2005

migrant from vb 6.0 to vb.net?

server side javascript in .net?

operator '&' is not defined for string

asp 3.0 to asp.net 2.0 c#

tools?

use webservice in classic asp

passing information from asp to asp.net and then asp.net to asp

migration / validations

could not switch to design view

call wcf from asp

   
  Privacy | Contact Us
All Times Are GMT