Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 12th, 2005, 07:00 PM
Registered User
 
Join Date: Nov 2004
Location: Houston, TX, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do you make a Data Grid Hyperlink Column pass

How do you make a Data Grid Hyperlink Column pass information from two columns in the database?

The Datagrid Property Builder allows me to insert anything in the URL Field, but when I put date, category in the URL Field I receive an error.


Can anyone provide me with some help?

  #2 (permalink)  
Old January 13th, 2005, 09:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What error did you receive?

  #3 (permalink)  
Old January 13th, 2005, 10:25 AM
Registered User
 
Join Date: Nov 2004
Location: Houston, TX, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by stu9820
 What error did you receive?

I tried it using & and received this error:

A field or property with the name 'category&date' was not found on the selected datasource.

Is there a way for it to recognize two fields?



  #4 (permalink)  
Old January 13th, 2005, 10:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Can you post your code?

  #5 (permalink)  
Old January 13th, 2005, 11:40 AM
Registered User
 
Join Date: Nov 2004
Location: Houston, TX, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by stu9820
 Can you post your code?

Sure, but this is where I'm speaking of is in the Data Grid Property Builder

public class MonthControl : System.Web.UI.UserControl
    {
        protected System.Web.UI.WebControls.DataGrid DataGrid1;
        protected string smonthnumber;
        protected string syearnumber;
        //protected System.Web.UI.WebControls.DataGridItem syearnumber;
        //Open Connection
        SqlConnection objConn = new SqlConnection(ConfigurationSettings.AppSettings["MyConn"]);
        protected System.Web.UI.WebControls.HyperLink MonthLink;
        SqlCommand objComm = new SqlCommand();
        SqlDataReader objRead;

        //char nYear;

        public string MonthNumber
        {
            get {return smonthnumber;}
            set {smonthnumber= value;}
        }

        public string YearDate
        {
            get {return syearnumber;}
            set {syearnumber = value;}
        }




        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            // nYear=char.Parse(Request["@Year"].ToString());
        }



        #region BindGrid()
        public void BindGrid()
        {

            objComm.CommandText = "sp_myStoredProcedure";
            objComm.CommandType = CommandType.StoredProcedure;
            objComm.Connection = objConn;
            objComm.Parameters.Add("@Month",SqlDbType.Char,2);
            objComm.Parameters["@Month"].Value = smonthnumber;
            objComm.Parameters.Add("@Year",SqlDbType.Char,4);
            //Change 1-11-05
            objComm.Parameters["@Year"].Value = syearnumber;
            //Change
            objComm.Connection.Open();
            DataGrid1.DataSource = objComm.ExecuteReader();

            DataGrid1.DataBind();

            objComm.Connection.Close();
            objComm.Parameters.Clear();

            MonthLink.NavigateUrl="monthabc.aspx?month=" + smonthnumber.ToString() +
                "&syearnumber="+syearnumber.ToString();





  #6 (permalink)  
Old January 13th, 2005, 11:43 AM
Registered User
 
Join Date: Nov 2004
Location: Houston, TX, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is it possible to create a Hyperlink Column here in the code behind?

Private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
{

}


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink url too long in data grid. Hughesie78 ASP.NET 2.0 Professional 2 May 12th, 2008 11:54 AM
export data grid hyperlink column to excel phyzie VS.NET 2002/2003 0 April 16th, 2007 01:45 AM
How to sort a column in data grid: kenn_rosie ASP.NET 1.0 and 1.1 Basics 1 January 26th, 2006 02:03 PM
Data Grid Drop Down List Column bmains ASP.NET 1.0 and 1.1 Professional 4 September 21st, 2004 08:39 AM



All times are GMT -4. The time now is 03:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.