3 Replies - 3426 Views - Last Post: 21 February 2013 - 06:56 PM Rate Topic: -----

#1 troyb408  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 18-August 12

Display issues with user controls and gridview

Posted 21 February 2013 - 12:11 PM

Hello -

Again thank you in advance to those that post. Here is my issues. I have my gridview and my user controls set. I have another page that inheirts the view and the control. My issues is that only one gridview and control is showing when the site runs. The stored procedure is working and pulling data so I know thats not it. Here is the code.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Wages.ascx.cs" Inherits="Analytic_OccDetail_Wages" %>
<h3>Regional Wages</h3>
<asp:GridView ID="g" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="ds" Visible="False" Width="100%" Caption="This table displays the average annual wages in the state for each industry" EmptyDataText="There are no wage data available for this occupation.">
<Columns>
<asp:BoundField DataField="industry_desc" HeaderText="Industry" SortExpression="industry_desc" />
<asp:TemplateField HeaderText="Annual Wages" SortExpression="annual_wages">
<ItemStyle HorizontalAlign="Right" Wrap="False" />
<ItemTemplate>
<asp:Label ID="l" runat="server" Text='<%# Bind("annual_wages", "{0:C0}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

<asp:ObjectDataSource ID="ds" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="Cea.WebApp.JobsEq.Dal.Sys.OccupationTableAdapters.StateWageTa">
<SelectParameters>
<asp:Parameter Name="soc_code" Type="String" />
<asp:Parameter Name="region_type" Type="Byte" />
<asp:Parameter Name="region_code" Type="Int32" />
<asp:Parameter Name="year" Type="Int16" />
<asp:Parameter Name="qtr" Type="Byte" />
</SelectParameters>
</asp:ObjectDataSource>
<p>
&nbsp;</p>

<div>
<asp:GridView ID="g2" runat="server" AutoGenerateColumns="False"
DataKeyNames="region_type,region_code,soc_code,year" DataSourceID="ds2"
BorderStyle="None" CellPadding="2" CellSpacing="2">
<Columns>
<asp:BoundField DataField="region_type" HeaderText="region_type"
ReadOnly="True" SortExpression="region_type" />
<asp:BoundField DataField="region_code" HeaderText="region_code"
ReadOnly="True" SortExpression="region_code" />
<asp:BoundField DataField="soc_code" HeaderText="soc_code" ReadOnly="True"
SortExpression="soc_code" />
<asp:BoundField DataField="year" HeaderText="year" ReadOnly="True"
SortExpression="year" />
<asp:BoundField DataField="mean" HeaderText="mean" SortExpression="mean" />
<asp:BoundField DataField="entry" HeaderText="entry" SortExpression="entry" />
<asp:BoundField DataField="experienced" HeaderText="experienced"
SortExpression="experienced" />
<asp:BoundField DataField="pct10" HeaderText="pct10" SortExpression="pct10" />
<asp:BoundField DataField="pct25" HeaderText="pct25" SortExpression="pct25" />
<asp:BoundField DataField="pct50" HeaderText="pct50" SortExpression="pct50" />
<asp:BoundField DataField="pct75" HeaderText="pct75" SortExpression="pct75" />
<asp:BoundField DataField="pct90" HeaderText="pct90" SortExpression="pct90" />
</Columns>
</asp:GridView>
</div>


<asp:ObjectDataSource ID="ds2" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="Cea.WebApp.JobsEq.Dal.Analytic.AdHocTableAdapters.adhoc_OccWagesTa">
<SelectParameters>
<asp:Parameter Name="region_type" Type="Byte" DefaultValue="1" />
<asp:Parameter Name="region_code" Type="Int32" DefaultValue="1" />
<asp:Parameter Name="year" Type="Int16" DefaultValue="2011" />
<asp:Parameter Name="soc_code" Type="String" DefaultValue="11-1011" />
</SelectParameters>
</asp:ObjectDataSource>


My page that inherits the page above

%@ Page Language="C#" MasterPageFile="~/content/occ/OccMaster.master" AutoEventWireup="true" CodeFile="OccWage.aspx.cs" Inherits="content_occ_OccWage" Title="State Wages" %>
<%@ Register Src="~/Analytic/OccDetail/Wages.ascx" TagName="Wages" TagPrefix="uc1" %>

**********************How do I get my other view displayed here (g2)?*******************************

<asp:Content ID="d" ContentPlaceHolderID="Detail" Runat="Server">
<uc1:Wages ID="ctlD" runat="server" />
</asp:Content>



Code Behind

public partial class content_occ_OccWage : CeaSecurePage
{
private const string cVsKey = "vs:occWages:details";

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
//SetSelectedAnalytic(AnalyticDefs.cOccDetWage);

dal.Occupation occ = dal.Occupation.Parse(Request.QueryString["o"]);
dal.Region reg = dal.Region.Load( SessionInfJobsEq.RegionType, SessionInfJobsEq.RegionCode);

ctlD.Params["soc_code"] = occ.SocCode.ToString();
ctlD.Params["region_type"] = reg.RegionType;
ctlD.Params["region_code"] = reg.RegionCode;
ctlD.Params["year"] = reg.ES202Latest.Year;
ctlD.Params["qtr"] = reg.ES202Latest.Qtr;
ctlD.Bind();
}
}

protected override object LoadPageStateFromPersistenceMedium()
{
return Session[cVsKey];
}

protected override void SavePageStateToPersistenceMedium(object state)
{
Session[cVsKey] = state;
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: Display issues with user controls and gridview

#2 troyb408  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 71
  • Joined: 18-August 12

Re: Display issues with user controls and gridview

Posted 21 February 2013 - 01:12 PM

Got if db year wasnt correctly formatting and since that wasnt correct grid wouldnt display
Was This Post Helpful? 0
  • +
  • -

#3 h4nnib4l  Icon User is offline

  • The Noid
  • member icon

Reputation: 1181
  • View blog
  • Posts: 1,677
  • Joined: 24-August 11

Re: Display issues with user controls and gridview

Posted 21 February 2013 - 02:12 PM

Please go back and edit that post and place [code] tags around your code. We're a lot more likely to try and read through it if you do.

This post has been edited by h4nnib4l: 22 February 2013 - 06:47 AM

Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,090
  • Joined: 02-July 08

Re: Display issues with user controls and gridview

Posted 21 February 2013 - 06:56 PM

If your control is built correctly then:

<uc1.Wages runat="server" /> 


It's a matter of the naming convention - {tagPrefix:tagName}
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1