Question

How do I pass an Int32 value from one page to another?

Asked by: dmasini

Experts...

Yes I'm a rookie here so I'll try to be as clear as possible.  I have 2 .aspx pages:

Page 1) products_lookup22.aspx
Page 2) products_EMail.aspx

"Page 1" has a search then a gridview (Like a Summary) that list general information about a product as in:

(Summary)
             "Catalog"                   "Vendor"                    "Description"                 "Rec#"
details   77L8453001D           ADVANCE                 400 WHPS BLST             38
details   TQC1110WL             GE-ED&C                   BRKR CIRCUIT 1P10A     1424
details   ICQ693MDL330        GE-ED&C                    OUT MODULE 2A           1674
details   IC697PWR711          GE-FANUC                 9070 POW SUP              1682
(ETC...)

IF the user clicks on the link "details" we open a "DetailsView" just below the summary grid that provides specifics on just the single record (example: we click "details" for record 38).  We see...

(Details)
Vendor:            ADVANCE
CATALOG:       77L8453001D
DESCRIPTION:  400 WHPS BLST            
NAED V/I:         781087-11529
SOLD BY:        EA
IN STOCK:        6
LIST PRICE:      $133.66    

OK...so far all is fine.   Everythings works as advertised.  Now what I need to do is 'pass' the value '38' to "Page 2" which has its own "DetailView" to look the record up again; this form will be e-mailed in its entirety via aspNetEMail.

At the bottom of "Page 1" I have hypertext link called "Get Quote...".  NavigateURL Code is:

~/products_EMail.aspx?RecordID2=RecordID

When I run it (click on "Get Quote..." hyperlink) the page changes to the following URL and I get the error message:

(URL) http://localhost:2467/hpoll-dd/products_EMail.aspx?RecordID2=RecordID

(ERROR MESSAGE)

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112
   System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
   System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
   System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264
   System.Web.UI.WebControls.Parameter.get_ParameterValue() +66
   System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +254
   System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +274
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +754
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.DetailsView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.DetailsView.EnsureDataBound() +181
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +50
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Control.PreRenderRecursiveInternal() +170
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

At the top of "Page 2" I dimension "RecordID2" as in:

Dim RecordID2 As Int32

The "Page 2" datasource and query is:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                         
SelectCommand="SELECT [CTMFGNAME], [CTSTOCK], [CTDESCRIPTION], [DISTSKU], [CTUM], [COMMODITYNAME], [RecordID] FROM [Cooper-Master-Items-Table] WHERE (([IDCPROVIDERCODE] = @IDCPROVIDERCODE) AND ([RecordID] = @RecordID2))">

<SelectParameters>
                            <asp:Parameter DefaultValue="IDC001" Name="IDCPROVIDERCODE" Type="String" />
                            <asp:QueryStringParameter Name="RecordID2" QueryStringField=RecordID2 Type="Int32" />
</SelectParameters>
                    </asp:SqlDataSource>

OK...SO
If I run this from "Page 1" I get the error message "Input string was not in a correct format."
If I run "Page 2" standalone as in URL "http://localhost:1905/hpoll-dd/products_EMail.aspx?recordid2=38" it displays fine...

Again...'a newbie' so Any feedback would be appreciated...

Thanks in advance!

DM
 

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-03-27 at 10:00:25ID23274783
Tags

Visual Web Developer 2005

,

all

,

Input string was not in a correct format

,

ASP.NET 2.0

Topics

Programming for ASP.NET

,

WebApplications

Participating Experts
1
Points
500
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Expected Int32?
    I have a ComboBox control I have added to a DataGrid, so when the user clicks on a cell in the 3rd column they get a drop down box. When I click on the cell in question, I get the following error and code stops on this line: ComboBoxInventoryItems.Text = Me.DataGridItemsOrd...
  2. checkbox in asp.net <asp:checkbox id="callback" ru…
    I have need a checkbox in asp.net vb, i have this so far: in the body: <asp:checkbox id="callback" runat="server" /> but how to i work it out at the top, this is what i have for the other text boxes, but for some reason i can not get the checkbox o...
  3. javascript function vs runat=server in asp.net
    hi there; using asp.net (vb), i have a mortgage calculator that uses a javascript function to produce the results. this works fine in a straight html page but when i add it to my aspx page, it doesn't display any results ... in fact, it produces an error (form.LoanAmount is ...
  4. Including .JS file in ASP.NET for runat=server
    Hi, I'm doing my first ASP.NET integration with SecPay, (an online payment provider in the UK). I've done plenty of integrations in classic ASP but am now struggling to get the md5 check to work in ASP.NET. I'm falling at the first hurdle of including the JS file. In class...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: the_bachelorPosted on 2008-03-27 at 10:34:06ID: 21223889

1) what I'll do If I were you is to put a HyperLink server control at the bottom of the page
and set its NavigateUrl Property at run time when you select the item.

2) I'm not real familiar with DetailViews but I imagine you could Have a template for the GetQuote link in such a way that its url is once again set properly when you click on Details.

post the markup i'll see what I can do (granted that u still havent found the answer)

 

by: dmasiniPosted on 2008-03-27 at 11:08:03ID: 21224235

the bachelor...

Hey...thanks for responding!  I guess (to sum it up) I need to (somehow)

pass this:  (URL) http://localhost:2467/hpoll-dd/products_EMail.aspx?RecordID2=38
 not this:    (URL) http://localhost:2467/hpoll-dd/products_EMail.aspx?RecordID2=RecordID

Just don't know where (or how) I would do that.  I am not familiar with hyperlink server controls as noted...

DM

 

by: the_bachelorPosted on 2008-03-27 at 11:33:55ID: 21224445

like i said, dmasini if you'd be so kind to post your markup, It be easier for me to see what u've already done and maybe point you in the direction I think might help you...

 

by: dmasiniPosted on 2008-03-27 at 11:50:43ID: 21224596

bachelor,

Sorry...I missed that.  OK here goes:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Page 1" (products_lookup22.aspx)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%@ Page Language="VB" Debug="True" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub DetailsView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewPageEventArgs)

    End Sub

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub SqlDataSource2_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs)

    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Product Inquiry</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;
        <asp:Panel ID="Panel1" runat="server" Height="1px" Width="850px" style="left: 4px; position: absolute; top: 10px;">
            <asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Size="Small" Style="font-weight: bold;
                font-size: 12pt; color: darkblue; font-style: normal; font-family: verdana;" Text="Search for:" Width="104px"></asp:Label>
            <asp:TextBox ID="TextBox2" runat="server" Width="316px"></asp:TextBox>
            <asp:Button ID="Button2" runat="server"
                Text="Go..." Width="84px" style="position: absolute; top: 1px" /><br />
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <br />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
            <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Size="Small" Style="font-weight: bold;
                font-size: 10pt; color: darkblue; font-style: normal; font-family: verdana;" Text="Total Records found:" Width="176px"></asp:Label><br />
                    <br />
            <asp:Image ID="Image2" runat="server" ImageUrl="~/images/summary-banner.jpg" /><br />
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" CellPadding="2" DataSourceID="SqlDataSource2" ForeColor="#333333"
                GridLines="None" DataKeyNames="RecordID" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
                <PagerSettings FirstPageImageUrl="~/images/first-record.bmp" FirstPageText="First Page..."
                    LastPageImageUrl="~/images/last-record.bmp" LastPageText="Last Page..." Mode="NextPreviousFirstLast"
                    NextPageImageUrl="~/images/next-record.bmp" NextPageText="Next Page..." Position="Top"
                    PreviousPageImageUrl="~/images/previous-record.bmp" PreviousPageText="Previous Page..." />
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <Columns>
                    <asp:CommandField SelectText="Details" ShowSelectButton="True">
                        <HeaderStyle BackColor="#C00000" Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left"
                            Width="30px" Wrap="False" />
                        <ItemStyle Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left" Width="30px"
                            Wrap="False" />
                    </asp:CommandField>
                    <asp:BoundField DataField="CTCATALOG" HeaderText="Catalog" SortExpression="CTCATALOG">
                        <HeaderStyle BackColor="#C00000" Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left"
                            Width="200px" Wrap="False" />
                        <ItemStyle Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left" Width="200px"
                            Wrap="False" />
                    </asp:BoundField>
                    <asp:BoundField DataField="CTMFGNAME" HeaderText="Vendor" SortExpression="CTMFGNAME">
                        <HeaderStyle BackColor="#C00000" Font-Size="X-Small" HorizontalAlign="Left" Width="150px" />
                        <ItemStyle Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left" Width="150px"
                            Wrap="False" />
                    </asp:BoundField>
                    <asp:BoundField DataField="CTDESCRIPTION" HeaderText="Description" SortExpression="CTDESCRIPTION">
                        <HeaderStyle Font-Size="X-Small" HorizontalAlign="Left" Width="200px" Wrap="False" BackColor="#C00000" />
                        <ItemStyle Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Left" Width="200px"
                            Wrap="False" />
                    </asp:BoundField>
                    <asp:BoundField DataField="RecordID" HeaderText="Rec#" InsertVisible="False" SortExpression="RecordID">
                        <HeaderStyle BackColor="#C00000" Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Right"
                            Width="32px" Wrap="False" />
                        <ItemStyle Font-Bold="True" Font-Size="X-Small" HorizontalAlign="Right" Width="32px"
                            Wrap="False" />
                    </asp:BoundField>
                </Columns>
                <PagerStyle BackColor="#C00000" ForeColor="#333333" HorizontalAlign="Left" />
                <SelectedRowStyle BackColor="Navy" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#C00000" Font-Bold="True" ForeColor="White" Width="636px" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
                <asp:Image ID="Image1" runat="server" ImageUrl="~/images/details-banner.jpg" Width="632px" /><br />
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="2"
                    DataSourceID="SqlDataSource3" ForeColor="#333333" GridLines="None" Height="50px"
                    OnPageIndexChanging="DetailsView1_PageIndexChanging" Width="632px">
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <CommandRowStyle BackColor="#FFFFC0" Font-Bold="True" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <Fields>
                        <asp:BoundField DataField="CTMFGNAME" HeaderText="Vendor:" SortExpression="CTMFGNAME">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CTCATALOG" HeaderText="Catalog:" SortExpression="CTCATALOG">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CTDESCRIPTION" HeaderText="Description:" SortExpression="CTDESCRIPTION">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DISTSKU" HeaderText="NAED V/I:" SortExpression="DISTSKU">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CTUM" HeaderText="Sold by:" SortExpression="CTUM">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ShippedQtyPAM" HeaderText="In Stock:" SortExpression="ShippedQtyPAM">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CurrSellPricePAM" DataFormatString="{0:c} (Negotiated pricing, SPA and qty/breakpoint pricing available!)" HeaderText="List Price:"
                            HtmlEncode="False" SortExpression="CurrSellPricePAM">
                            <HeaderStyle BackColor="Navy" Font-Bold="True" Font-Size="Small" ForeColor="White"
                                HorizontalAlign="Right" Width="100px" Wrap="False" />
                            <ItemStyle Font-Bold="True" Font-Size="Small" BackColor="Navy" ForeColor="Yellow" />
                        </asp:BoundField>
                    </Fields>
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:DetailsView>
                    &nbsp;&nbsp;<br />
                    &nbsp;&nbsp;
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/products_EMail.aspx?RecordID2=RecordID" Target="_blank">Get Quote...</asp:HyperLink></a>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            &nbsp;
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
            Font-Bold="True" Font-Names="Verdana" Font-Size="Small" ForeColor="Maroon" GridLines="None"
            PageSize="1" ShowHeader="False" Style="position: absolute; left: 184px; top: 44px;"
            Width="88px">
            <Columns>
                <asp:BoundField DataField="norecs" NullDisplayText="Sorry...No records found matching the search string...)"
                    ReadOnly="True" ShowHeader="False" SortExpression="norecs">
                    <ItemStyle Font-Bold="True" Font-Size="Small" ForeColor="Maroon" />
                </asp:BoundField>
            </Columns>
        </asp:GridView>
            &nbsp;<br />
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                SelectCommand="SELECT CTMFGNAME, CTSTOCK, CTCATALOG, CTDESCRIPTION, DISTSKU, CTUM, COMMODITYNAME, RecordID FROM [Cooper-Master-Items-Table] WHERE (CTMFGNAME LIKE '%' + @CTCATALOG + '%') OR (CTCATALOG LIKE '%' + @CTCATALOG + '%') OR (CTDESCRIPTION LIKE '%' + @CTCATALOG + '%') OR (DISTSKU LIKE '%' + @CTCATALOG + '%') OR (COMMODITYNAME LIKE '%' + @CTCATALOG + '%') AND (IDCPROVIDERCODE = 'IDC001')" OnSelecting="SqlDataSource2_Selecting">
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBox2" Name="CTCATALOG" PropertyName="Text" />
                </SelectParameters>
            </asp:SqlDataSource>
            &nbsp;&nbsp;<br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                SelectCommand="SELECT COUNT('DISTINCT @CTCATALOG') AS norecs FROM [Cooper-Master-Items-Table] WHERE (CTMFGNAME LIKE '%' + @CTCATALOG + '%') OR (CTCATALOG LIKE '%' + @CTCATALOG + '%') OR (CTDESCRIPTION LIKE '%' + @CTCATALOG + '%') OR (DISTSKU LIKE '%' + @CTCATALOG + '%') OR (COMMODITYNAME LIKE '%' + @CTCATALOG + '%') AND (IDCPROVIDERCODE = 'IDC001')">
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBox2" Name="CTCATALOG" PropertyName="Text" />
                </SelectParameters>
            </asp:SqlDataSource>
            &nbsp;<br />
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                SelectCommand="SELECT [CTMFGNAME], [CTCATALOG], [CTDESCRIPTION], [DISTSKU], [CTUM], [ShippedQtyPAM], [CurrSellPricePAM] FROM [Cooper-Master-Items-Table] WHERE ([RecordID] = @RecordID)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="RecordID" PropertyName="SelectedValue"
                        Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
            &nbsp;
            </asp:Panel>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
    </form>
</body>
</html>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Page 2" (products_EMail.aspx)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<%@ Page Language="VB" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<script runat="server">

    Dim DoEmailSend As Boolean = False
    Dim RecordID2 As Int32
   

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        DoEmailSend = True
       
    End Sub
   
    Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
 
        'create a new HtmlTextWriter so we can get at the page's source
        Dim stringWriter As New IO.StringWriter()
        Dim htmlWriter As New HtmlTextWriter(stringWriter)
 
        'render the page
        MyBase.Render(htmlWriter)
 
        'get the html source of the current page
        Dim html As String = stringWriter.ToString()
 
        If DoEmailSend Then
            'send it as an email
            SendEmail(html)
        End If
   
        'send to the browser
        writer.Write(html)
    End Sub 'Render
 
    Sub SendEmail(ByVal html As String)
        'create an email object, and set the mail server = "mail.mycompany.com"
        Dim msg As aspNetEmail.EmailMessage = New aspNetEmail.EmailMessage("win2003.guicorporation.com")
       
       
        'set recipient error logging off
        msg.IgnoreRecipientErrors = True
       
        'set exception throwing off
        msg.ThrowException = False

        '****************************************************************
        '*** These lines removed to address issue with stripping off pulldowns when sending
        '*** HTML pages via e-mail.  Replaced with new dll 3.6.0.12
        '*** msg.Body = html
        '*** since we are loading a html page, set the bodyformat
        '*** msg.BodyFormat = aspNetEmail.MailFormat.Html
        '****************************************************************
       
        'set logging on
        msg.Logging = True
        msg.LogPath = "c:\aspNetMail-Logs\aspnetmail.log"
       
        msg.WriteLineToLog("======= START RAW HTML =======")
        msg.WriteLineToLog(html)
        msg.WriteLineToLog("======= END RAW HTML =======")
       
       
        Dim hu As New aspNetEmail.HtmlUtility(msg)
        hu.LoadString(html, Nothing)
        hu.HtmlRemovalOptions = hu.HtmlRemovalOptions Or aspNetEmail.HtmlRemovalOptions.EventArgument Or aspNetEmail.HtmlRemovalOptions.InputHiddenTag Or aspNetEmail.HtmlRemovalOptions.InputSubmitTag Or aspNetEmail.HtmlRemovalOptions.ReplaceSelectTagWithSelectedText Or aspNetEmail.HtmlRemovalOptions.ReplaceInputTextAreaWithValue

        hu.Render()
 
        msg = hu.ToEmailMessage()
       
        'set the from address
        msg.FromAddress = TextBox1.Text
       
 
        'set the to address
        msg.To = "dmasini@guicorporation.com"
       
       
        'set the Misc Comment line
        msg.Subject = TextBox3.Text
       
 
        'set the content encoding
        msg.ContentTransferEncoding = aspNetEmail.MailEncoding.QuotedPrintable
       

        'send the email
        msg.Send()
 
    End Sub
     
</script>
   
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Request a Quote via E-Mail</title>
    </head>
<body>
    <form id="form1" runat="server">

    <div>
        <br />
        <table style="width: 564px; border-left-color: silver; border-bottom-color: silver; border-top-style: ridge; border-top-color: silver; border-right-style: ridge; border-left-style: ridge; border-right-color: silver; border-bottom-style: ridge;">
            <tr>
                <td style="height: 363px; width: 472px;">
                    <table id="TABLE1" style="width: 528px" language="javascript" onclick="return TABLE1_onclick()">
                        <tr>
                            <td bgcolor="maroon" style="height: 24px" colspan="2">
                            <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Names="Verdana"
            Font-Size="Small" ForeColor="DarkBlue" Text="Quote Form..." style="font-weight: bold; font-size: 10pt; color: white; font-family: verdana"></asp:Label></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border-left-color: navy; border-bottom-color: navy; border-top-style: solid;
                                border-top-color: navy; border-right-style: solid; border-left-style: solid;
                                height: 29px; border-right-color: navy; border-bottom-style: solid">
                                <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Verdana" ForeColor="Navy"
                                    Style="text-align: center" Text="(Please provide a quote for the following item...)" Font-Size="Medium"></asp:Label></td>
                        </tr>
                        <tr>
                            <td style="height: 25px; width: 252px; text-align: right; background-color: gray;">
                                <strong style="border-top-width: thin; font-weight: bold; border-left-width: thin; border-left-color: gray; border-bottom-width: thin; border-bottom-color: gray; color: white; border-top-color: gray; border-right-width: thin; border-right-color: gray"> Your E-Mail:</strong></td>
                            <td style="width: 278873px; height: 25px">
                                &nbsp;<asp:TextBox ID="TextBox1" runat="server" Width="428px" Height="24px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="height: 24px; width: 252px; text-align: right; font-weight: bold; color: white; background-color: gray;">
                                <strong> To:</strong></td>
                            <td style="width: 278873px; height: 24px; font-weight: bold; font-size: 12pt; color: black; font-family: Arial;">
                                sales@hpoll.com</td>
                        </tr>
                        <tr>
                            <td style="height: 24px; width: 252px; text-align: right; font-weight: bold; color: white; background-color: gray;">
                                <strong>Subject:</strong></td>
                            <td style="width: 278873px; height: 24px; font-weight: bold; font-size: 12pt; font-family: Arial;">
                                Please provide a quote for the following item...</td>
                        </tr>
                        <tr>
                            <td style="font-weight: bold; width: 252px; height: 20px; text-align: right; border-top-width: thin; border-left-width: thin; border-left-color: blue; border-bottom-width: thin; border-bottom-color: blue; vertical-align: top; color: white; border-top-color: blue; background-color: gray; border-right-width: thin; border-right-color: blue;">
                                Note:</td>
                            <td style="width: 278873px; height: 20px">
                                <asp:TextBox ID="TextBox3" runat="server" Height="24px" Width="528px" ToolTip="Enter any misc notes here..." style="cursor: text"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td bgcolor="maroon" style="height: 24px" colspan="2">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 24px">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                    <asp:Label ID="Label3" runat="server" Text="Quantity Needed:" Width="180px"></asp:Label>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
                        DataSourceID="SqlDataSource2" Height="136px" Width="600px">
                        <Fields>
                            <asp:BoundField DataField="CTMFGNAME" HeaderText="CTMFGNAME" SortExpression="CTMFGNAME" />
                            <asp:BoundField DataField="CTSTOCK" HeaderText="CTSTOCK" SortExpression="CTSTOCK" />
                            <asp:BoundField DataField="CTDESCRIPTION" HeaderText="CTDESCRIPTION" SortExpression="CTDESCRIPTION" />
                            <asp:BoundField DataField="DISTSKU" HeaderText="DISTSKU" SortExpression="DISTSKU" />
                            <asp:BoundField DataField="CTUM" HeaderText="CTUM" SortExpression="CTUM" />
                            <asp:BoundField DataField="COMMODITYNAME" HeaderText="COMMODITYNAME" SortExpression="COMMODITYNAME" />
                            <asp:BoundField DataField="RecordID" HeaderText="RecordID" InsertVisible="False"
                                SortExpression="RecordID" />
                        </Fields>
                        <HeaderStyle BackColor="#FFFFC0" HorizontalAlign="Right" VerticalAlign="Top" />
                        <PagerSettings Position="Top" />
                        <RowStyle BackColor="#FFFBD6" />
                        <FieldHeaderStyle BackColor="#FFFF99" ForeColor="#404040" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:DetailsView>
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send..." style="width: 200px; cursor: hand;" OnClientClick='alert("Page Captured.  Click OK to Send!")' />
                                <asp:Button ID="Button2" runat="server" OnClientClick="window.close()" Style="width: 200px; cursor: hand;"
                                    Text="Close this Window..." /><br />
                    <asp:Panel ID="Panel1" runat="server" Height="50px" Style="width: 600px; font-weight: bold; font-size: 8pt; color: silver; font-family: verdana;" Width="125px">
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                        <br />
                        (To prevent Spam the originating IP Address was:
                        <%=Request.ServerVariables("REMOTE_ADDR")%>)
                        <br />
                        <br />
                        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                        ********************** ** LEGAL DISCLAIMER ************************
                        <br />
                        This E-mail message and any attachments may contain legally privileged, confidential
                        or proprietary information. If you are not the intended recipient(s), or the employee
                        or agent responsible for delivery of this message to the intended recipient(s),
                        you are hereby notified that any dissemination, distribution or copying of this
                        E-mail message is strictly prohibited. If you have received this message in error,
                        please immediately notify the sender and delete this E-mail message from your computer.</asp:Panel>
                    <br />
                    <br />
                    <br />
                    <br />
                </td>
            </tr>
        </table>
        <br />
        &nbsp;<br />
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                         
                        SelectCommand="SELECT [CTMFGNAME], [CTSTOCK], [CTDESCRIPTION], [DISTSKU], [CTUM], [COMMODITYNAME], [RecordID] FROM [Cooper-Master-Items-Table] WHERE (([IDCPROVIDERCODE] = @IDCPROVIDERCODE) AND ([RecordID] = @RecordID2))">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="IDC001" Name="IDCPROVIDERCODE" Type="String" />
                            <asp:QueryStringParameter Name="RecordID2" QueryStringField=RecordID2 Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
        &nbsp;<br />
        &nbsp;<br />
        <br />
        <br />
        <br />
        <br />
   
    </div>
    </form>
</body>
</html>

 

by: the_bachelorPosted on 2008-03-27 at 13:52:47ID: 21225649

okay try this (quick and dirty)


    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
              Me.HyperLink1.NavigateUrl="~/products_EMail.aspx?RecordID2=" & GridView1.DataKeys(GridView1.SelectedIndex).Value.ToString
    End Sub

 

by: dmasiniPosted on 2008-03-27 at 18:31:08ID: 21227336

bachelor,

Your a Genius (or Expert!) and it DOES work as long as I select record 4 (or below)!!!!   I originally thought that maybe I had a SQL cursor problem since I was using a ScriptManager and UpdatePanel (AJAX) so I converted it to a regular Panel to refresh everytime the "details" link is clicked.  Regardless (regular or AJAX) it works fine as long as the "selected record" is record 4 or higher!

Note it does include Paging but I get the same result.  If I select 1-3 I always get "Page 2" (_blank) but no details...(example: search is for "120/240" if you select any records 1-3 it will display the 'details' (as noted above) and when hovering the "Get Quote..." it will show in the browser feedback as http://localhost:2467/hpoll-dd/products_EMail.aspx?RecordID2=1424))

When products_EMail.aspx opens a new window on records 1,2 or 3 I see no detail info...if I select record 4 (or lower) it works fine.  Duh.  I'm a bit confused on this behavior!  

As always I appreciate ANY feedback...we're 90% there!

DM

 

by: the_bachelorPosted on 2008-03-27 at 19:16:19ID: 21227547

dmasini, I dont know why this is happening.
The only thing I can think of if the fact that maybe, just maybe, in your database, you dont have any child record associasted to record 1 through 3. Can you check on that?

 

by: dmasiniPosted on 2008-03-28 at 08:46:37ID: 31443815

bachelor,

Ever have one of those "DUH" moments!?  So I was rethinking the problem and went into the SQL DB to review selection and indexes.  Lo and behold I saw that when I was querying the PRODUCT MASTER (Page 1 - GridView1) I should have been selecting ONLY records that met the search criteria (example: 120/240 in TextBox2) AND partner records that equal IDC001!  

Since I failed to do this GridView1 was returning additional records that DID NOT belong to IDC001 - then clicking on "Get Quote..." would invoke "Page 2" (param passed correctly) and would come up blank (example: RecordID 1424 was owned by "IDCPROVIDERCODE" IDC004 not IDC001)....

I tweaked the queries and it works perfectly now!!!  I so much thank you for your time...its always a pleasure to work with the Experts!!!!

Grade: Excellent!  500 points to you!

Thanks again,

DM

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...