Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Dynamic Websites w/ Web Matrix
This is the forum to discuss the Wrox book Beginning Dynamic Websites: with ASP.NET Web Matrix by Dave Sussman, James Greenwood, Alex Homer, Colt Kwong, John M. West; ISBN: 9780764543746
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Dynamic Websites w/ Web Matrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2005, 11:11 AM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default MxDataGrid Control

Hi everybody
I’ am trying to work with chapter n. 9 but I have some problems with the Fields property of MxDataGrid control, after connected to the Cam database and drag the Discs table, when I click on the Fields property I get an empty MXDataGridField collection.
I have tried to add myself the BoundField but when I run the application on the browser I get a page with duplicated fields (the original one plus those I added myself).

Please help me
Thanks:)


 
Old April 25th, 2005, 12:57 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to make the auto generate columns property of the grid to false

 
Old April 25th, 2005, 12:03 PM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried this solution before but using this method I get an empty MXDataGridField collection.
I don't think this is the way because web matrix should supply automatically a collection with all the BoundField of used table.

thanks anyway


 
Old April 26th, 2005, 01:32 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote: I get an empty MXDataGridField collection.
Its should work fine

Try the code below

Code:
<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<script runat="server">

    Function GetData() As System.Data.DataSet
            Dim connectionString As String = "server='(local)'; trusted_connection=true; database='pubs'"
            Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

            Dim queryString As String = "SELECT [authors].[au_id], [authors].[au_lname], [authors].[au_fname], [authors].["& _
    "phone], [authors].[address], [authors].[zip], [authors].[state], [authors].[city"& _
    "] FROM [authors]"
            Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
            dbCommand.CommandText = queryString
            dbCommand.Connection = dbConnection

            Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
            dataAdapter.SelectCommand = dbCommand
            Dim dataSet As System.Data.DataSet = New System.Data.DataSet
            dataAdapter.Fill(dataSet)

            Return dataSet
        End Function' Insert page code here
    '

    Sub Page_Load(sender As Object, e As EventArgs)

        MxDataGrid1.Datasource = GetData()

    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <wmx:MxDataGrid id="MxDataGrid1" runat="server" AutoGenerateFields="False">
            <Fields>
                <wmx:BoundField DataField="au_id" HeaderText="au_id"></wmx:BoundField>
                <wmx:BoundField DataField="au_lname" HeaderText="au_lname"></wmx:BoundField>
            </Fields>
        </wmx:MxDataGrid>

    </form>
</body>
</html>
 
Old April 26th, 2005, 02:01 AM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I don't think the problem it's about code
but web matrix behaviour, perhaps a problem of configuration or installation


 
Old April 26th, 2005, 03:06 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I still in midway,
Post the code
Let Me see






Similar Threads
Thread Thread Starter Forum Replies Last Post
The control that triggered the UpdatePanel control Kika ASP.NET 2.0 Professional 0 January 17th, 2008 01:13 PM
How to put a button control in a GridView control ryan.webb ASP.NET 2.0 Basics 2 December 28th, 2007 05:26 AM
Can't move focus to control <control scptech Access VBA 8 October 26th, 2007 12:16 PM
Help! Custom Server Control using User Control diehard ASP.NET 1.0 and 1.1 Professional 2 January 4th, 2006 12:33 PM
Help with control initialization in user control mike_remember ASP.NET 1.0 and 1.1 Professional 7 December 19th, 2005 11:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.