1. I have a customer table with log in user name and password;
2. I have an order table with customerID linked to the customer table;
3. I have a shipping table with orderID linked to the order table and trackingNumber and courierID
What I am trying to do is:
1. After a customer logs in, a gridview shows all his orders with the orderID as a linkButton, when the customer clicks the orderID, a DetailsView will display at the lower part of the same page, showing the shipping info with the tracking number as a linkButton
(I succefully reach this point so far);
2. Next I expect when the customer clicks the trackingNumber, he would be directed to the corresponding tracking page per the courier (I am stuck right here. I got this error message:"Compiler Error Message:
BC30456: 'TrackOrder' is not a member of 'ASP.Order_customerOrder_aspx'."
Below are my codes. Can somebody help me out? Thanks so much.
Your Sub TrackOrder doesn't have an access modifier. That means it will be Internal. For a Sub to be used in the .aspx, it must be either Protected or Public. Protected is customary. So add Protected to the Sub definition, and it could very well work.
Note: There are naming conventions for event handlers that will make it easier for others to read your code. It is customary to use the ID and the event name, separated by a _. In this case: LinkButton2_Click instead of TrackOrder.
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
Sorry I forgot about my project for a while.
First of all, thanks a lot for the suggestions by superguppie. I followed their suggestions to add "Protected" to the Sub defination, then do a little more hard searches on how to retrieve data out of a detailsview, finally get the following working codes:
Protected Sub TrackOrder(ByVal Src As Object, ByVal Args As EventArgs)
Dim SetCourier As String
Dim SetTrackNo As String
If SetCourier = "FEDEX" Then
Response.Redirect("http://www.fedex.com/Tracking?" & "ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=" & setTrackNo)
End If
End Sub
Notes:
In the ShippedOrderDetails DetailsView, the first row (row(0))is ShippedDate, I added another row for CourierID as the second row (row(1)), the third row (row(2)) is TrackingNumber.
I romove the LinkButton in the DetailsView but add a button to trigger the event.
Now I want to add a label to: 1). If ShippedDate is null, shows "This item is not shipped yet." 2). If ShippedDate is not null, shows "This item is shipped on #ShippedDate#.
Besides, I want the Button to be visible only if the ShippedDate is not null.
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
gd2012
0 Points
3 Posts
simple web store order tracking
Mar 19, 2012 03:49 AM|LINK
Dear All,
I'm doing a simple web store project:
1. I have a customer table with log in user name and password;
2. I have an order table with customerID linked to the customer table;
3. I have a shipping table with orderID linked to the order table and trackingNumber and courierID
What I am trying to do is:
1. After a customer logs in, a gridview shows all his orders with the orderID as a linkButton, when the customer clicks the orderID, a DetailsView will display at the lower part of the same page, showing the shipping info with the tracking number as a linkButton (I succefully reach this point so far);
2. Next I expect when the customer clicks the trackingNumber, he would be directed to the corresponding tracking page per the courier (I am stuck right here. I got this error message:"Compiler Error Message: BC30456: 'TrackOrder' is not a member of 'ASP.Order_customerOrder_aspx'."
Below are my codes. Can somebody help me out? Thanks so much.
<td class="style2" colspan="2"> <asp:GridView ID="OrderGrid" runat="server" Width="600px" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="AccessDataSource1" Font-Names="Arial" Font-Size="9pt" GridLines="Vertical" DataKeyNames="OrderID" EnableModelValidation="True"> <AlternatingRowStyle BackColor="#DCDCDC" /> <Columns> <asp:TemplateField HeaderText="Order Number (click to see shipping)" HeaderStyle-Width="160px" HeaderStyle-Font-Size="10pt" ItemStyle-Font-Size="10pt"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" Runat="Server" Text='<%# Eval("OrderID") %>' CommandName="Select"/> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="OrderDate" DataFormatString="{0:d}" HeaderText="Order Date" SortExpression="Date"> <ControlStyle Font-Names="Arial" Font-Size="10pt" /> <ItemStyle Width="100px" /> </asp:BoundField> </Columns> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> <RowStyle BackColor="#EEEEEE" ForeColor="Black" /> <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="<%$ connectionStrings:AccessCarsConnection %>" SelectCommand="SELECT [OrderID], [OrderDate] FROM [Orders] WHERE ([CustomerID] = ?) ORDER BY [OrderDate] DESC"> <SelectParameters> <asp:CookieParameter CookieName="User" DefaultValue="NULL" Name="UserID" Type="String" /> </SelectParameters> </asp:AccessDataSource> </td> </tr> <tr> <td class="style9" colspan="2"> <asp:AccessDataSource id="ShippedOrder" Runat="Server" DataFile="<%$ connectionStrings:AccessCarsConnection %>" SelectCommand="SELECT [TrackingNumber], [ShipDate], [Destination], [CourierID], FROM [Shipping] WHERE ([OrderID] = ?)"> <SelectParameters> <asp:ControlParameter Name="OrderID" ControlId="OrderGrid" PropertyName="SelectedValue" DefaultValue="NULL" Type="String"/> </SelectParameters> </asp:AccessDataSource> </td> </tr> <tr> <td class="style8"> <asp:DetailsView ID="ShippedOrderDetails" runat="server" AutoGenerateRows="False" BackColor="#A5CAE5" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="OrderShipped" EnableModelValidation="True" GridLines="Vertical" Caption="<b>Shipped Order with Tracking Number</b>" CaptionAlign="Left" Align="Left" Height="90px" Width="300px"> <AlternatingRowStyle BackColor="#DCDCDC" /> <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <Fields> <asp:BoundField DataField="ShippedDate" DataFormatString="{0:d}" HeaderText="Shipped Date" SortExpression="Date" /> <asp:TemplateField HeaderText="Tracking Number"> <ItemTemplate> <asp:LinkButton ID="LinkButton2" Text='<%# Eval("TrackingNumber") %>' OnClick="TrackOrder" Runat="Server" /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Destination" HeaderText="Destination" SortExpression="Destination" /> </Fields> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> <RowStyle BackColor="#EEEEEE" ForeColor="Black" /> </asp:DetailsView> <br /> </td> <SCRIPT Runat="Server"> Sub TrackOrder(ByVal Src As Object, ByVal Args As EventArgs) Dim SetCourier As String Dim SetTrackNo As String SetCourier = '<%# Eval("CourierID") %>' setTrackNo = '<%# Eval("TrackingNumber") %>' If SetCourier = "FEDEX" Then Response.Redirect("http://www.fedex.com/Tracking?" & "ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=" & setTrackNo) End If End Sub </SCRIPT>Vipindas
Contributor
5514 Points
810 Posts
Re: simple web store order tracking
Mar 19, 2012 04:45 AM|LINK
Refer this
http://www.emadibrahim.com/2007/01/11/aspnet-20-error-title-is-not-a-member-of-asp%E2%80%A6/
http://stackoverflow.com/questions/1545538/asp-net-error-bc30456-title-is-not-a-member-of-asp-views-controllername-view
Hope this helps...
superguppie
All-Star
48225 Points
8679 Posts
Re: simple web store order tracking
Mar 20, 2012 09:53 AM|LINK
Your Sub TrackOrder doesn't have an access modifier. That means it will be Internal. For a Sub to be used in the .aspx, it must be either Protected or Public. Protected is customary. So add Protected to the Sub definition, and it could very well work.
Note: There are naming conventions for event handlers that will make it easier for others to read your code. It is customary to use the ID and the event name, separated by a _. In this case: LinkButton2_Click instead of TrackOrder.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
gd2012
0 Points
3 Posts
Re: simple web store order tracking
Apr 28, 2012 07:37 PM|LINK
Sorry I forgot about my project for a while.
First of all, thanks a lot for the suggestions by superguppie. I followed their suggestions to add "Protected" to the Sub defination, then do a little more hard searches on how to retrieve data out of a detailsview, finally get the following working codes:
Protected Sub TrackOrder(ByVal Src As Object, ByVal Args As EventArgs)
Dim SetCourier As String
Dim SetTrackNo As String
SetCourier = ShippedOrderDetails.Rows(1).Cells(1).Text
setTrackNo = ShippedOrderDetails.Rows(2).Cells(1).Text
If SetCourier = "FEDEX" Then
Response.Redirect("http://www.fedex.com/Tracking?" & "ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=" & setTrackNo)
End If
End Sub
Notes:
In the ShippedOrderDetails DetailsView, the first row (row(0))is ShippedDate, I added another row for CourierID as the second row (row(1)), the third row (row(2)) is TrackingNumber.
I romove the LinkButton in the DetailsView but add a button to trigger the event.
Now I want to add a label to: 1). If ShippedDate is null, shows "This item is not shipped yet." 2). If ShippedDate is not null, shows "This item is shipped on #ShippedDate#.
Besides, I want the Button to be visible only if the ShippedDate is not null.
superguppie
All-Star
48225 Points
8679 Posts
Re: simple web store order tracking
May 09, 2012 03:01 PM|LINK
It is probably easiest to convert the BoundField for ShippedDate to a TemplateField. In the ItemTemplate put something like
<%# IIF(Eval("ShippedDate") = System.DBNull.Value, "Not shipped yet", Eval("ShippedDate")) %>Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.