Skip to Content

Another Modification question :)

ok, my last post was about getting DisplayName from user table and get it into the datagrid.

now im trying something similar, im trying to get an extra column with the postalcode in the customers.ascx from the dashboard.

i have learned a lot from my last post and i know now what kind of methods and data is available in netpoint.dll

Since customers from the api isnt that complex compared to the accountsearch if tried the following code

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="customers.ascx.cs" Inherits="netpoint.dashboard.controls.customers" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

<%@ Page Language="C#" Inherits="netpoint.classes.NPBasePage" %>

<%@ Import Namespace = "netpoint.api.utility" %>

<%@ Import Namespace = "netpoint.api.account" %>

<%@ Import Namespace = "System.Data" %>

<script runat="server">

protected void Grid_ItemDataBound(object sender, DataGridItemEventArgs e)

{

NPBasePage page = (NPBasePage)this.Page;

DataRowView MyRow = (DataRowView)e.Item.DataItem;

if (myRow == null) return;

String PostalCode = address.PostalCode;

Literal literal4 = (Literal)e.Item.FindControl("ltlPostalCode");

}

</script>

<asp:datagrid id="grid" PageSize="50" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"

Width="100%" runat="server">

<ItemStyle CssClass="npadminbody"></ItemStyle>

<AlternatingItemStyle CssClass="npadminbodyalt"></AlternatingItemStyle>

<HeaderStyle CssClass="npadminsubheader"></HeaderStyle>

<Columns>

<asp:HyperLinkColumn DataTextField="AccountName" HeaderText="colName" SortExpression="AccountName" DataNavigateUrlField="AccountID"

DataNavigateUrlFormatString="~/admin/common/accounts/AccountInfo.aspx?accountid="></asp:HyperLinkColumn>

<asp:TemplateColumn HeaderText="PostalCode" SortExpression="PostalCode">

<ItemTemplate>

<asp:Literal ID="ltlPostalCode" runat="server"></asp:Literal>

</ItemTemplate>

</asp:TemplateColumn>

the rest of the code is not interresting since its not changing.

the problem is when i try to run this it gives the following error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The directive 'Page' is unknown.

Source Error:

Line 1: <%@ Control Language="c#" AutoEventWireup="false" Codebehind="customers.ascx.cs" Inherits="netpoint.dashboard.controls.customers" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

***Line 2: <%@ Page Language="C#" Inherits="netpoint.classes.NPBasePage" %>**** error here

Line 3: <%@ Import Namespace = "netpoint.api.utility" %>

Line 4: <%@ Import Namespace = "netpoint.api.account" %>

so i was wondering if some of you guys give a look at it and could tell me what im doing wrong (or its not even possible )

thnx

Kind regards,

C. Oude Luttikhuis

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 26, 2007 at 01:03 PM

    Hi C Oude,

    glad to see you are getting stuck in 😊

    the problm is that this is a control tyou are modifying; whereas the line in error is trying to give a @Page directive; this is only valid on a Page (like a .aspx webform). So take the line out. Also the Control already inherits from the netpoint.dashboard.controls.customer control so you don't need to (in fact you can't) inherit from anything else.

    However even when you fix this error, I don;t think the control will work as you expected. Specifically, because there is no code that actually tells the Grid to bind to a datasource...the Grid_ItemDatabound only gets called after you have bound data to the grid using Bind()

    So for example you would need to write a Page_Load handler that would take data that had just been posted to the control's containing page, then get your list of customers (probably an arraylist or dataset) using this data, and then bind it to the grid.

    Don't be discouraged though, I am on vacation at the moment but when I get back in a few days I will have a look at it for you and try and come up with a solution.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.