[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Datagrid problem

Asked by TheInnovator in Programming for ASP.NET, C# Programming Language

Tags: ASP.NET

I created a gridview that renders 5 columns to a page.
In the last column, the data that is rendered is based on
data from a column data in a table.  Also, I want the last column to be
a link as a querystring.  I'm a little confused b/c my codebehind
is on a different page.  In PHP, b/c the script and html were on the
same page, it was easier.  Below I have PHP code and I just want to
do the same in ASP.NET.  I also have the ASP.NET and my codebehind (C#) below.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
PHP
------
  <TR style="font-size:12px;font-family:arial;background-color:<?php echo $row_color; ?>">
	  	  	<TD><?php echo $row["medDte"]; ?></TD>
	  	  	<TD><?php echo getMediaName($row["medType"]); ?></TD>
	  	  	<TD><?php echo $row["medCopy"]; ?></TD>
	  	  	<TD><?php echo $row["medPurpose"]; ?></TD>
	  	  	<TD align="center">
	  	  	<?php
	  	  		//echo "copies: ".$row["medCopy"];
	  	  		if ($row["medCopy"] > 1)
	  	  		{
	  	  			echo "<a href='mediaDetail.php?medid=".$row["medID"]."&reqID=".$row["ReqID"]."'>Detail</a>";
	  	  		}
	  	  		else
	  	  		{
	  	  			$sql = "SELECT
	  	  						dbo.tblRequestor.ReqID AS Expr1,
	  	  						dbo.tblRequestor.pid,
	  	  						dbo.tblMediaTracker.statusID AS medStatusID,
	  	  						dbo.tblMediaTracker.MediaID,
	  	  						dbo.tblMediaTracker.MediaIDNumber As medIDNumber,
	  	  						dbo.tblMediaTracker.mediaTrackID as mediaTrackID
							FROM
								dbo.tblMediaTracker INNER JOIN
                      			dbo.tblRequestor ON dbo.tblMediaTracker.reqID = dbo.tblRequestor.ReqID WHERE dbo.tblRequestor.pid=".$_SESSION["pid"]." AND dbo.tblMediaTracker.MediaID=".$row["medID"];
                      			//echo $sql;
					$results = mssql_query($sql);
					if ($rows=mssql_fetch_array($results))
					{
						if ($rows["medStatusID"] == 4)
						{
							echo "<a href='cancelRequest.php?trackId=".$rows["mediaTrackID"]."&type=single&medid=".$row["medID"]."'><img border=0 src='image/delete.gif' alt='Delete Request'></a>";
						}
						elseif ($rows["medStatusID"] != 3)
						{
							echo "<A HREF=javascript:popUp('statusPop.php?trackId=".$rows["mediaTrackID"]."&statusId=".$rows["medStatusID"]."&typed=".$row["medType"]."&cnt=(1)')>".getStatusName($rows["medStatusID"])."</a>";
							echo "<br><span style=font-size:10px;font-weight:bold>Media ID #:".$rows["medIDNumber"]."</span>";
						}
						else
						{
							echo "<span style='font-style:italics;color:red'>DESTROYED</span>";
						}
					}
	  	  		}
	  	  	?>
	  	  </TD>
	  	  <!-- <TD><a HREF=javascript:popUp('statusPop.php')>Cancel</a></TD> -->
	  	  </TR>
 
 
 
 
 
 
ASP.NET
----------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myRequest.aspx.cs" Inherits="RequestMedia.myRequest" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link href="mediaCSS.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
	<!-- ****************** BEGIN OUTER TABLE ****************** -->
	<table width="95%" cellpadding="0" cellspacing="0" border="0" align="center">
	  <tr>
	    <td width="15%" bgcolor="#ffffff" valign="top">
	        <div id="navcontainer">
                <ul id="navlist">
                    <li><a href="default.aspx" id="newNavMed" style="">New Media Request</a></li>
                    <li><a href="#" id="navReq" style="">My Media Requests</a></li>
                </ul>
            </div>
	    </td>
	    <td bgcolor="#dddddd">
	    <!-- ****************** BEGIN 1ST INNER TABLE ****************** -->
	  	<table width="100%" cellpadding="3" cellspacing="1" border="0">
	  	  <tr>
			  <td class="tblHeading" colspan="2">New Media Request</td>
		  </tr>
		  <tr>
			  <td class="formFields" colspan="2">    
                <asp:GridView ID="myRequestGridView1" runat="server" onselectedindexchanged="GridView1_SelectedIndexChanged" AutoGenerateColumns="false" Width="100%">
                <Columns>
                    <asp:BoundField DataField="medDte" HeaderText="Request Date" HeaderStyle-HorizontalAlign="Left" />
                    <asp:BoundField DataField="medType" HeaderText="Type" HeaderStyle-HorizontalAlign="Left" />
                    <asp:BoundField DataField="medCopy" HeaderText="# of Media" HeaderStyle-HorizontalAlign="Left" />
                    <asp:BoundField DataField="medPurpose" HeaderText="Purpose" HeaderStyle-HorizontalAlign="Left" />      
                    <asp:templatefield>
                        <ItemTemplate>
                            <label id="mediaLink"><a href="requestDetail.aspx?">Detail</a></label>
                        </ItemTemplate>
                    </asp:templatefield>    
                </Columns>
                </asp:GridView>
              </td>
            </tr>
        </table>
        </td>
    </tr>
    </table>
    </form>
</body>
</html>
 
Code Behind
---------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
 
namespace RequestMedia
{
    public partial class myRequest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["toucanMedia"].ConnectionString;
            conn.Open();
 
            SqlCommand cmd = new SqlCommand("getUserMedID", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@pid", 1208));
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
 
            DataSet media = new DataSet();
            adapter.SelectCommand = cmd;
            adapter.Fill(media);
 
            myRequestGridView1.DataSource = media;
            myRequestGridView1.DataBind();
 
            conn.Close();
        }
 
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }
    }
}
[+][-]09/29/09 11:46 AM, ID: 25451999Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/29/09 11:47 AM, ID: 25452012Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/29/09 12:13 PM, ID: 25452296Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/29/09 12:31 PM, ID: 25452501Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 05:35 AM, ID: 25457991Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/30/09 07:00 AM, ID: 25458901Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 07:17 AM, ID: 25459085Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 07:18 AM, ID: 25459093Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 07:52 AM, ID: 25459546Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/30/09 08:03 AM, ID: 25459667Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 08:04 AM, ID: 25459672Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/09 10:07 AM, ID: 25460944Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/30/09 10:23 AM, ID: 25461110Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/01/09 06:43 AM, ID: 25468517Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/01/09 08:05 AM, ID: 25469496Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/01/09 08:06 AM, ID: 25469503Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/01/09 02:04 PM, ID: 25473219Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/01/09 02:09 PM, ID: 25473253Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/02/09 06:22 AM, ID: 25477579Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/02/09 06:23 AM, ID: 25477591Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/05/09 01:37 PM, ID: 25499454Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/05/09 01:43 PM, ID: 25499516Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, C# Programming Language
Tags: ASP.NET
Sign Up Now!
Solution Provided By: locke_a
Participating Experts: 2
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625