Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 March 8th, 2007, 10:48 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid help

I created the site http://www.ebhl.org for my morning hockey league. One of the users requested a group email to be added to the roster of each team to make emailing everyone on that team easier. The problem is, that the large size of the email address string makes the grid stretch out and look terrible. I would like to remove the group email from the grid and add it to a button click event. Here is the code that I'm using to fill the datagrid.

private void LoadData(string s)
        {
            // check s for the team name then laod all the data
            OleDbConnection myConn = new OleDbConnection(Session["ConnStr"].ToString());
            myConn.Open();

            // add the query
            string sql = "Select * from TeamRoster where Team = '" + s + "'";

            // create the command object
            OleDbCommand myCommand = new OleDbCommand(sql,myConn);

            // create an object to handle the return
            OleDbDataReader Result = myCommand.ExecuteReader();

            DataGrid1.DataSource = Result;
            DataGrid1.Width = 600;
            DataGrid1.DataBind();
            myConn.Close();
        }

Go to the web site, click on "Rosters" and then click on "Kings" to see what I'm referring to.
Can anyone tell me how to fill the grid with all the records except the group email and then set the group email to a variable for a redirect?


 
Old March 8th, 2007, 11:23 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So I used the query text to exclude the name "Group Email" from the results, and then created another procedure call to only retrieve records with the name "Group Email". However, I was looking for a more elegant solution. Now I need help with click event and how to do a redirect to open the email but not open a new page. But, that would be OT here so I'll post that question in the appropriate spot.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
Creating DataGrid In Repeater/DataGrid liduwan ASP.NET 1.0 and 1.1 Professional 9 March 6th, 2007 03:31 PM
datagrid ajaidass ADO.NET 2 March 1st, 2007 05:36 PM
Need help regarding datagrid ngsharmila .NET Framework 1.x 1 February 1st, 2006 12:55 AM





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