Solved

Popup Javascript after query is ran. URGENT Question

Posted on 2004-10-16
21
387 Views
Last Modified: 2012-08-13
Basically when I run the query I will have
the following

Payment Number          Cashier Number          Date
12345                             8888888                  14-10-2004          Select Button
12346                             8888888                  14-10-2004          Select Button

Now if I click the select button I want a popup with

The following built with string builder

Payment Number: 12345
Cashier Number:   888888
Date:                   14-10-2004

I have include the .cs and .aspx as followed:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Data.Odbc;
using System.Text;
using System.Data.Common;
namespace MSPOS
{
      /// <summary>
      /// Summary description for Receipts.
      /// </summary>
      public class Receipts : System.Web.UI.Page
      {
            protected System.Web.UI.WebControls.RadioButtonList Group_RadioButtonList;
            protected System.Web.UI.WebControls.DataGrid ReceiptsDataGrid;
            private DataSet ddlDataSet = new DataSet();
            private OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");
            protected System.Web.UI.WebControls.Button btnRunQuery;
            protected ActiveUp.WebControls.ActiveDateTime ActiveDateTime2;
            protected System.Web.UI.WebControls.TextBox txtPayment;
            protected ActiveUp.WebControls.ActiveDateTime ActiveDateTime1;
            protected System.Web.UI.WebControls.TextBox txtCashier;
            
            private DataSet ddlDataSet1 = new DataSet();
            private DataSet ddlDataSet2 = new DataSet();
            protected System.Web.UI.WebControls.Literal Literal1;
            private DataSet ddlDataSet3 = new DataSet();
 
            private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here
                  if (!Page.IsPostBack)
                  {
                        ActiveDateTime1.Date = System.DateTime.Today.Date;
                        ActiveDateTime2.Date = System.DateTime.Today.Date;
                  }
            }

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.Group_RadioButtonList.SelectedIndexChanged += new System.EventHandler(this.Group_RadioButtonList_SelectedIndexChanged);
                  this.btnRunQuery.Click += new System.EventHandler(this.btnRunQuery_Click);
                  this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion

            private string DecodeReceipt (string szBill)
            {
                  string szNewBill;
                  szNewBill = "";
                  for (int i = 1; i <= szBill.Length-1;i++)
                  {
                        char a = szBill[i];

                        if ((int)(a) ==10 || (int)(a) ==15 || (int)(a)==18 || (int)(a) ==27)
                        {}          
                        else if ((int)(a) == 13)
                              szNewBill = "";
                        else
                              szNewBill = szNewBill + a;
                  }
                  return szNewBill;
            }

            private void txtPayment_TextChanged(object sender, System.EventArgs e)
            {
            
            }

            private void txtCashier_TextChanged(object sender, System.EventArgs e)
            {
            
            }

            //***********************************************************************
            // Get RC_PAYMND and populate dataset
            public DataSet BindRC_PAYMND(string searchstring)
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet1
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_PAYMNB FROM TBRECEIPTS WHERE RC_PAYMNB='"+searchstring+"'";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet1.Clear();  
                  myDataAdapter.Fill(ddlDataSet1, "ddlRC_PAYMNB");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet1;
            }
            //***********************************************************************

            //***********************************************************************
            // Get RC_CASHND and populate dataset
            public DataSet BindRC_CASHND(string searchstring)
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet2
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_CASHNB FROM TBRECEIPTS WHERE RC_CASHNB='"+searchstring+"'";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet2.Clear();  
                  myDataAdapter.Fill(ddlDataSet2, "ddlRC_CASHNB");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet2;
            }
            //***********************************************************************


            //***********************************************************************
            // Get RC_CASHND and populate dataset with RC_CASHND and RC_DATE
            public DataSet BindRC_DATE()
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet3
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_DATE FROM TBRECEIPTS";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet3.Clear();  
                  myDataAdapter.Fill(ddlDataSet3, "ddlRC_DATE");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet3;
            }
            //***********************************************************************


            public void ReceiptsDataGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
            {
                  ListItemType oType = ((ListItemType)e.Item.ItemType);
                  if(oType == ListItemType.Item || oType == ListItemType.AlternatingItem)
                  {
                        e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue'");            
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Beige'");            
                  }
                  if(e.CommandName =="selectrow")
                  {
                        this.Literal1.Text="<script>alert('"+e.Item.Cells[1].Text+"')</script>";//this will display the payment #
                  }

                  if (oType == ListItemType.Item || oType == ListItemType.AlternatingItem)
                  {

                        string paymentnum = e.Item.Cells[0].Text;                                   // line 1
                        string cashiernum = e.Item.Cells[1].Text;
                        string date       = e.Item.Cells[2].Text;
                        string receipt    = e.Item.Cells[3].Text;
                  //      WebControl Button1 = (WebControl) e.Item.Cells[4].Controls[0];               // line 2
                  //      StringBuilder info = new StringBuilder("PAYMENT#:");
                  //      info.Append(" + paymentnum + ");
                  //      info.Append("+").Append("CASH#:").Append("+");
                  //      info.Append("+").Append(cashiernum).Append("+");
            
                  //      info.Append("'").Append("CASH#:").Append("+ ,");
                  //      info.Append("'").Append(cashiernum).Append("+ ");
//                        button.Attributes.Add("onclick", "javascript:alert('" + info + "')"); // line 3
            //            Button1.Attributes.Add("onclick", "javascript:alert('" + info + "'); return false;"); // line 3

                  }

                  //if ( e.Item.ItemType == ListItemType.Header )
                  //      {
                  //      e.Item.Cells[0].Text = "Payment Number"; //change the text for the first column
                  //      e.Item.Cells[1].Text = "Account Number"; //change the text for the first column
                  //      e.Item.Cells[2].Text = "Date"; //change the text for the first column
                  //      }

            }


            private void Group_RadioButtonList_SelectedIndexChanged(object sender, System.EventArgs e)
            {
            
            }

            public void btnRunQuery_Click(object sender, System.EventArgs e)
            {
                  string select_statement = "SELECT RC_PAYMNB, RC_CASHNB, RC_DATE, RC_DATA FROM TBRECEIPTS";
                  string DateString1 = ActiveDateTime1.Date.Day.ToString() + "-" + ActiveDateTime1.Date.Month.ToString() + "-" + ActiveDateTime1.Date.Year.ToString();
                  string DateString2 = ActiveDateTime2.Date.Day.ToString() + "-" + ActiveDateTime2.Date.Month.ToString() + "-" + ActiveDateTime2.Date.Year.ToString();

                  Response.Write (DateString1 +"<BR>");
                  switch (Group_RadioButtonList.SelectedIndex)
                  {
                        case 0:
                              select_statement += " Where RC_PAYMNB='" + txtPayment.Text + "'";
                              break;
                        case 1:
                              select_statement += " Where RC_CASHNB='" + txtCashier.Text + "'";
                              break;
                        case 2:
                              select_statement += " Where RC_DATE<='" + ActiveDateTime2.Date + "' And RC_DATE >= '" + ActiveDateTime1.Date + "'"; //i don't know the type of these fields so this is the reason that i use text property
                              break;
                  }


                  OdbcConnection myConnection =  new
                  OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet1
                  myConnection.Open();
                  string strSQLDDL = select_statement;
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,myConnection);
                  ddlDataSet1.Clear();  
                  myDataAdapter.Fill(ddlDataSet1);
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  ReceiptsDataGrid.DataSource = ddlDataSet1.Tables[0];
                  ReceiptsDataGrid.DataBind();
            
        }
            

      }
}


===================================================

<%@ Register TagPrefix="mspos" TagName="footer" Src="~/Engine/Controls/footer.ascx" %>
<%@ Register TagPrefix="mspos" TagName="header" Src="Engine/Controls/header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="logout" Src="Engine/Controls/logout.ascx" %>
<%@ Page Language="c#" trace="true" Codebehind="Receipts.aspx.cs" AutoEventWireup="false" Inherits="MSPOS.Receipts" CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"'%>
<%@ Register TagPrefix="cc1" Namespace="ActiveUp.WebControls" Assembly="ActiveDateTime" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
      </HEAD>
      <body leftMargin="0" background="images/bg.gif" topMargin="0" marginwidth="0" marginheigh="0">
            <form id="Form1" action="database.aspx" method="post" runat="server">
                  <strong>
                        <P>
                              <mspos:header id="Header1" runat="server"></mspos:header><BR>
                              <FONT face="Verdana" size="2"></FONT>
                        </P>
                        <P><FONT face="Verdana" size="2"></FONT>&nbsp;</P>
                        <FONT face="Verdana" size="2">
                              <P>
                                    <TABLE id="Table2" height="118" cellSpacing="1" cellPadding="1" width="355" border="0">
                                          <TR>
                                                <TD vAlign="top" width="147" colSpan="1" rowSpan="4">
                                                      <P>
                                                            <asp:radiobuttonlist id="Group_RadioButtonList" runat="server" BackColor="#FEF9E9" Width="35px" Font-Names="Verdana"
                                                                  Font-Size="12px" Font-Bold="True" Height="111px" CellPadding="1" CellSpacing="1" BorderWidth="0px">
                                                                  <asp:ListItem Value="PayNumber">1</asp:ListItem>
                                                                  <asp:ListItem Value="Cashier">2</asp:ListItem>
                                                                  <asp:ListItem Value="StartDate">3</asp:ListItem>
                                                            </asp:radiobuttonlist></P>
                                                      &nbsp;&nbsp;
                                                </TD>
                                                <TD noWrap colSpan="1" rowSpan="1">Payment Number:</TD>
                                                <TD vAlign="middle" noWrap width="200" colSpan="1" rowSpan="1">
                                                      <asp:textbox id="txtPayment" runat="server" MaxLength="10"></asp:textbox></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240">Cashier Number:</TD>
                                                <TD>
                                                      <asp:textbox id="txtCashier" runat="server" MaxLength="8"></asp:textbox></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240" height="10">Start Date:</TD>
                                                <TD height="10">
                                                      <cc1:activedatetime id="ActiveDateTime1" runat="server" MonthNamesDisabled="True" Format="DAY;/;MONTH;/;YEAR"
                                                            AllowNull="False" DateStyle-Font-Bold="True" DateStyle-Font-Size="X-Small" DateStyle-Font-Name="Verdana"
                                                            Enabled="True" AutoAdjust="False"></cc1:activedatetime></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240">End Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                </TD>
                                                <TD>
                                                      <cc1:activedatetime id="ActiveDateTime2" runat="server" MonthNamesDisabled="True" Format="DAY;/;MONTH;/;YEAR"
                                                            AllowNull="False" DateStyle-Font-Bold="True" DateStyle-Font-Size="X-Small" DateStyle-Font-Name="Verdana"
                                                            Enabled="True" EnableClientScript="False"></cc1:activedatetime></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240"></TD>
                                                <TD>
                                                      <asp:button id="btnRunQuery" onclick="btnRunQuery_Click" runat="server" type="submit" text="Run Query"></asp:button></TD>
                                          </TR>
                                    </TABLE>
                        </FONT></strong>
                  <br>
                  <strong>Results of:</strong>
                  <asp:Literal id="Literal1" runat="server"></asp:Literal>
                  <asp:datagrid id="ReceiptsDataGrid" runat="server" CellSpacing="1" CellPadding="1" AutoGenerateColumns="False"
                        BorderWidth="3px" BorderColor="#CCCC99" Height="144px" Width="400px" font-names="Verdana"
                        font-size="XX-Small" BorderStyle="Outset" GridLines="None" maintainviewstate="false" HeaderStyle-Font-Bold="True"
                        OnItemDataBound="ReceiptsDataGrid_ItemCommand">
                        <AlternatingItemStyle Wrap="False" BackColor="PaleGoldenrod"></AlternatingItemStyle>
                        <ItemStyle Wrap="False" BackColor="Beige"></ItemStyle>
                        <HeaderStyle Font-Size="14px" Font-Bold="True" ForeColor="White" BackColor="#954896"></HeaderStyle>
                        <Columns>
                              <asp:BoundColumn DataField="RC_PAYMNB" HeaderText="Payment Number "></asp:BoundColumn>
                              <asp:BoundColumn DataField="RC_CASHNB" HeaderText="Cash Number"></asp:BoundColumn>
                              <asp:BoundColumn DataField="RC_DATE" HeaderText="Date"></asp:BoundColumn>
                              <asp:TemplateColumn>
                                    <ItemTemplate>
                                          <asp:Button CommandName="selectrow" Text="selectrow" Runat="server" ID="Button1"></asp:Button>
                                    </ItemTemplate>
                              </asp:TemplateColumn>
                        </Columns>
                  </asp:datagrid></P></form>
      </body>
</HTML>
0
Comment
Question by:mathieu_cupryk
  • 11
  • 10
21 Comments
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12326626
Hi,
Please try to use this code part ...... Hope it helps you.

if(e.CommandName =="selectrow")
{
      StringBuilder strAlert = new StringBuilder();
      strAlert.Append("<script language=javascript> alert(");
      strAlert.Append("Payment Number: " + e.Item.Cells[0].Text + "\\n");
      strAlert.Append("Cashier Number:   " + e.Item.Cells[1].Text + "\\n");
      strAlert.Append("Date:                     " + e.Item.Cells[2].Text + "\\n");
      strAlert.Append(");</script>");
      this.RegisterStartupScript("startup",strAlert.ToString());
}

Thanks,
Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12326679
HI Suku,

I get this error:

What should I do?
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0123: Method 'MSPOS.Receipts.ReceiptsDataGrid_ItemCommand(object, System.Web.UI.WebControls.DataGridCommandEventArgs)' does not match delegate 'void System.Web.UI.WebControls.DataGridItemEventHandler(object, System.Web.UI.WebControls.DataGridItemEventArgs)'

Source Error:

 

Line 64:                   <strong>Results of:</strong>
Line 65:                   <asp:Literal id="Literal1" runat="server"></asp:Literal>
Line 66:                   <asp:datagrid id="ReceiptsDataGrid" runat="server" CellSpacing="1" CellPadding="1" AutoGenerateColumns="False"
Line 67:                         BorderWidth="3px" BorderColor="#CCCC99" Height="144px" Width="400px" font-names="Verdana"
Line 68:                         font-size="XX-Small" BorderStyle="Outset" GridLines="None" maintainviewstate="false" HeaderStyle-Font-Bold="True"
 

0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12326691
Hi mathieu,

in HTML CODE .....
<asp:datagrid id="ReceiptsDataGrid" runat="server" CellSpacing="1" CellPadding="1" AutoGenerateColumns="False"
                        BorderWidth="3px" BorderColor="#CCCC99" Height="144px" Width="400px" font-names="Verdana"
                        font-size="XX-Small" BorderStyle="Outset" GridLines="None" maintainviewstate="false" HeaderStyle-Font-Bold="True"
                        OnItemDataBound="ReceiptsDataGrid_ItemCommand">

Change the (OnItemDataBound="ReceiptsDataGrid_ItemCommand" ) to OnItemCommand="ReceiptsDataGrid_ItemCommand"

and check ...

Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12326724
There is an error on the javascript.
An error has occurred in the script on this page.

Line: 802
Char: 16
Error:  Expected ')'
Code: 0
URL:  http://localhost/MSPOS/Receipts.aspx

Do you want to continue running scripts on this page?
0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12326735
Sorry pal i forget to put quotes in alert

if(e.CommandName =="selectrow")
{
      StringBuilder strAlert = new StringBuilder();
      strAlert.Append("<script language=javascript> alert('");
      strAlert.Append("Payment Number: " + e.Item.Cells[0].Text + "\\n");
      strAlert.Append("Cashier Number:   " + e.Item.Cells[1].Text + "\\n");
      strAlert.Append("Date:                     " + e.Item.Cells[2].Text + "\\n");
      strAlert.Append("');</script>");
      this.RegisterStartupScript("startup",strAlert.ToString());
}

Now check....

Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12326761
Ok that is cool!!!

Just one other stupid question. I downloaded this ActiveDateTime server control  free from http://www.activeup.com/products/components/activedatetime/
I am not sure on how what to put in the InitializeComponent in order to keep the onchange value if the user does a submit on certain values the values will stay the same.

If I modify the value and then press run button the value resets 1/10/2004. I am missing something stupid. I have to fix this. I posted this up. I will give u the points for this.



<cc1:activedatetime id="ActiveDateTime1" runat="server" MonthNamesDisabled="True" Format="DAY;/;MONTH;/;YEAR"
AllowNull="False" DateStyle-Font-Bold="True" DateStyle-Font-Size="X-Small" DateStyle-Font-Name="Verdana"
Enabled="True" AutoAdjust="False"></cc1:activedatetime></TD>
</TR>
<TR>
<TD width="240">End Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</TD>
<TD>
<cc1:activedatetime id="ActiveDateTime2" runat="server" MonthNamesDisabled="True" Format="DAY;/;MONTH;/;YEAR"
AllowNull="False" DateStyle-Font-Bold="True" DateStyle-Font-Size="X-Small" DateStyle-Font-Name="Verdana"
Enabled="True" EnableClientScript="False"></cc1:activedatetime></TD>
                                    
When I press the Run Query button

public void btnRunQuery_Click(object sender, System.EventArgs e)
            {
string select_statement = "SELECT RC_PAYMNB, RC_CASHNB, RC_DATE, RC_DATA FROM TBRECEIPTS";
                  string DateString1 = ActiveDateTime1.Date.Day.ToString() + "-" + ActiveDateTime1.Date.Month.ToString() + "-" + ActiveDateTime1.Date.Year.ToString();
                  string DateString2 = ActiveDateTime2.Date.Day.ToString() + "-" + ActiveDateTime2.Date.Month.ToString() + "-" + ActiveDateTime2.Date.Year.ToString();

                  Response.Write (DateString1 +"<BR>");
                  switch (Group_RadioButtonList.SelectedIndex)
                  {
                        case 0:
                              select_statement += " Where RC_PAYMNB='" + txtPayment.Text + "'";
                              break;
                        case 1:
                              select_statement += " Where RC_CASHNB='" + txtCashier.Text + "'";
                              break;
                        case 2:
                              select_statement += " Where RC_DATE<='" + ActiveDateTime2.Date + "' And RC_DATE >= '" + ActiveDateTime1.Date + "'"; //i don't know the type of these fields so this is the reason that i use text property
                              break;
                  }




0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12326787
hi pal,
I checked with the control if u give the format as MONTH;/;DAY;/;YEAR then there is no problem. It is working fine.. Check with that ... I am trying with DAY/MONTH/YEAR Format ....


Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12326794
Thank you so much I hope we find the problem
0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12326866
Hi pal,
I solved the problem. The problem is in the control itself. I have corrected that. Can u give me any mail address so that i can send u the dll to you. Or if u have the source of the activedate then  go to ActiveDateTime.cs file. in that find the function LoadPostData. Replace the line if (this.Format.ToUpper().IndexOf(";DAY;") > -1) with if (this.Format.ToUpper().IndexOf("DAY;") > -1). Our problem solved :-).

Actually the problem is they are cheking the index of the ;DAY; in the format property.If it is the format Month;/;Day;/;year; then it is OK. We changed the format to Day;/;Month;/;Year so there is no semicolon before the day. So it gives the value as one. I have posted the same answer to that question too. Please check...

Hope it helps you.
Cheers
Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12328942
Yep here it is mcupryk@sun.net.bb

I appreciate it.

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:mathieu_cupryk
ID: 12329106
I get the new error:

The year value (2004) of the Date property is greater than the maximum (1986) or less than the minimum (1904). Please adjust values or set AutoAdjust property to true.
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.Exception: The year value (2004) of the Date property is greater than the maximum (1986) or less than the minimum (1904). Please adjust values or set AutoAdjust property to true.

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:


[Exception: The year value (2004) of the Date property is greater than the maximum (1986) or less than the minimum (1904). Please adjust values or set AutoAdjust property to true.]
   ActiveUp.WebControls.ActiveDateTime.WriteSelector(HtmlTextWriter output, String suffix, Style style, String onchange, Int32 min, Int32 max, Int32 padding, Int32 selectedValue, Boolean allowNull, Int32 nullChars) +974
   ActiveUp.WebControls.ActiveDateTime.Render(HtmlTextWriter output) +1314
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +130
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +44
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +130
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +130
   System.Web.UI.Page.ProcessRequestMain() +1909

 

0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12336163
Hi pal,
Hope you received the DLL. Please check the Max year and min year in the control. Still the error exists than please explain me when the error is generated. It will help me to find the problem.

Cheers,
Sukumar
0
 

Author Comment

by:mathieu_cupryk
ID: 12337446
I still get the error:-(

With postback on the DAY;/;MONTH;/;YEAR
0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12337503
Hi Mathieu,
Try the following.

1. Add the dll i sent to u to the toolbox in a new project and just test with that. I have checked here it is working fine.

2. http://www.activeup.com/downloads/ Goto this URL. In Product to download dropdown list select Activedatetime v1.2 Full Source Code and download the source. OPen the Project. Go to ActiveDateTime.cs file in the source. In that file find LoadPostData function  Replace the line if (this.Format.ToUpper().IndexOf(";DAY;") > -1) with if (this.Format.ToUpper().IndexOf("DAY;") > -1). Build the dll. Place the dll where your older version exists. and check it.

I hope these things will help you solving the problem. If u have any probs mail me. We will try to solve that.

Sukumar

0
 

Author Comment

by:mathieu_cupryk
ID: 12337874
<Columns>
                              <asp:BoundColumn DataField="RC_PAYMNB" HeaderText="Payment Number "></asp:BoundColumn>
                              <asp:BoundColumn DataField="RC_CASHNB" HeaderText="Cash Number"></asp:BoundColumn>
                              <asp:BoundColumn DataField="RC_DATE" HeaderText="Date"></asp:BoundColumn>
                              <asp:BoundColumn DataField="RC_DATA" Visible="False" HeaderText="Data"></asp:BoundColumn>
                              <asp:TemplateColumn>
                                    <ItemTemplate>
                                          <asp:Button CommandName="View" Text="View" Runat="server" ID="Button1"></asp:Button>
                                    </ItemTemplate>
                              </asp:TemplateColumn>
                              <asp:TemplateColumn>
                                    <ItemTemplate>
                                          <asp:Button CommandName="Print" Text="Print" Runat="server" ID="Button2"></asp:Button>
                                    </ItemTemplate>
                              </asp:TemplateColumn>
                        </Columns>

So I will need to add something

if(e.CommandName =="Print")
{
            string parsedreceipt = null;
            parsedreceipt = DecodeReceipt (e.Item.Cells[3].Text);
            ***Print
}
0
 

Author Comment

by:mathieu_cupryk
ID: 12337916
Ok but the validation is not working on the date?

public void btnRunQuery_Click(object sender, System.EventArgs e)
            {
                  string select_statement = "SELECT RC_PAYMNB, RC_CASHNB, RC_DATE, RC_DATA FROM TBRECEIPTS";
                  string DateString1 = ActiveDateTime3.Date.Day.ToString() + "-" + ActiveDateTime3.Date.Month.ToString() + "-" + ActiveDateTime3.Date.Year.ToString();
                  string DateString2 = ActiveDateTime4.Date.Day.ToString() + "-" + ActiveDateTime4.Date.Month.ToString() + "-" + ActiveDateTime4.Date.Year.ToString();

                  Response.Write (DateString1 +"<BR>");
                  Response.Write (DateString2 +"<BR>");
                  
                  switch (Group_RadioButtonList.SelectedIndex)
                  {
                        case 0:
                              select_statement += " Where RC_PAYMNB='" + txtPayment.Text + "'";
                              break;
                        case 1:
                              select_statement += " Where RC_CASHNB='" + txtCashier.Text + "'";
                              break;
                        case 2:
                              select_statement += " Where RC_DATE<='" + ActiveDateTime4.Date + "' And RC_DATE >= '" + ActiveDateTime3.Date + "'"; //i don't know the type of these fields so this is the reason that i use text property
                              break;
                  }


                  OdbcConnection myConnection =  new
                  OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet1
                  myConnection.Open();
                  string strSQLDDL = select_statement;
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,myConnection);
                  ddlDataSet1.Clear();  
                  myDataAdapter.Fill(ddlDataSet1);
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  ReceiptsDataGrid.DataSource = ddlDataSet1.Tables[0];
                  ReceiptsDataGrid.DataBind();
            
        }

For case 2:
0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12344746
hi,
hope u r doing well. Which validation is not working. As i said in the before u can format the date using ToString('yourformatstring'). Try with that. Check your mail too... Hope these helps..
Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12346928

thank you for asking,
            case 2:
                              select_statement += " Where To_Date(RC_DATE, 'MMDDYY') <=To_Date('" + ActiveDateTime4.Date + "', 'MMDDYY') And To_Date(RC_DATE, 'MMDDYY') >= To_Date('" + ActiveDateTime3.Date + "', 'MMDDYY')";
 

                              break;
                  }


//select_statement += " Where RC_DATE <='" + ActiveDateTime4.Date + "' And RC_DATE >= '" + ActiveDateTime3.Date + "'"; //i don't know the type of these fields so this is the reason that i use text property
                  //SELECT TO_CHAR(RC_DATE, 'DD-MM-YYYY') AS RC_DATE

I am not sure what to put?
0
 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12348055
Hi
Check with this code.

   select_statement += " Where To_Date(RC_DATE, 'MM-dd-YY') <=To_Date('" + ActiveDateTime4.Date.ToString("MM-dd-yy") + "', 'MM-dd-yy') And To_Date(RC_DATE, 'MM-dd-yy') >= To_Date('" + ActiveDateTime3.Date.ToString("MM-dd-yy") + "', 'MM-dd-yy')";


Suku
0
 

Author Comment

by:mathieu_cupryk
ID: 12348497
I get not a valid month error

Server Error in '/MSPOS' Application.
--------------------------------------------------------------------------------

ERROR [HY000] [Oracle][ODBC][Ora]ORA-01843: not a valid month
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: Microsoft.Data.Odbc.OdbcException: ERROR [HY000] [Oracle][ODBC][Ora]ORA-01843: not a valid month

Source Error:


Line 244:                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,myConnection);
Line 245:                  ddlDataSet1.Clear();  
Line 246:                  myDataAdapter.Fill(ddlDataSet1);
Line 247:                  myDataAdapter.Dispose();
Line 248:                  myDataAdapter = null;
 

Source File: c:\inetpub\wwwroot\mspos\receipts.aspx.cs    Line: 246

Stack Trace:


[OdbcException: ERROR [HY000] [Oracle][ODBC][Ora]ORA-01843: not a valid month
]
   Microsoft.Data.Odbc.OdbcConnection.HandleError(IntPtr hHandle, SQL_HANDLE hType, RETCODE retcode) +27
   Microsoft.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method) +838
   Microsoft.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior) +53
   Microsoft.Data.Odbc.OdbcCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +5
   System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
   MSPOS.Receipts.btnRunQuery_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\mspos\receipts.aspx.cs:246
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1281

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Request Details
Session Id: qce2ae45pv4tfl453op1sdzj Request Type: POST
Time of Request: 10/19/2004 11:43:39 AM Status Code: 500
Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin Init  
aspx.page End Init 0.000062 0.000062
aspx.page Begin LoadViewState 0.000099 0.000037
aspx.page End LoadViewState 0.000388 0.000289
aspx.page Begin ProcessPostData 0.000420 0.000032
aspx.page End ProcessPostData 0.000547 0.000127
aspx.page Begin ProcessPostData Second Try 0.000577 0.000030
aspx.page End ProcessPostData Second Try 0.000607 0.000030
aspx.page Begin Raise ChangedEvents 0.000641 0.000034
aspx.page End Raise ChangedEvents 0.000665 0.000024
aspx.page Begin Raise PostBackEvent 0.000687 0.000022
Unhandled Execution Error
ERROR [HY000] [Oracle][ODBC][Ora]ORA-01843: not a valid month

  at Microsoft.Data.Odbc.OdbcConnection.HandleError(IntPtr hHandle, SQL_HANDLE hType, RETCODE retcode)
  at Microsoft.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method)
  at Microsoft.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
  at Microsoft.Data.Odbc.OdbcCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
  at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
  at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
  at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
  at MSPOS.Receipts.btnRunQuery_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\mspos\receipts.aspx.cs:line 246
  at System.EventHandler.Invoke(Object sender, EventArgs e)
  at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
  at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
  at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
  at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
  at System.Web.UI.Page.ProcessRequestMain() 3.030978 3.030291
Control Tree
Control Id Type Render Size Bytes (including children) Viewstate Size Bytes (excluding children)
Cookies Collection
Name Value Size
Polls_Question20 101 20
ASP.NET_SessionId qce2ae45pv4tfl453op1sdzj 42
Headers Collection
Name Value
Cache-Control no-cache
Connection Keep-Alive
Content-Length 678
Content-Type application/x-www-form-urlencoded
Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Accept-Encoding gzip, deflate
Accept-Language en-us
Cookie Polls_Question20=101; ASP.NET_SessionId=qce2ae45pv4tfl453op1sdzj
Host localhost
Referer http://localhost/MSPOS/Receipts.aspx
User-Agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)
Form Collection
Name Value
__VIEWSTATE dDwyMDc2ODMyNjU7dDw7bDxpPDE+Oz47bDx0PDtsPGk8OT47aTwxMT47aTwxNT47PjtsPHQ8cDxsPF9kYXRlOz47bDxTeXN0ZW0uRGF0ZVRpbWUsIG1zY29ybGliLCBWZXJzaW9uPTEuMC41MDAwLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OTwyMDA0LTEwLTE5Pjs+Pjs7Pjt0PHA8bDxfZGF0ZTs+O2w8NTA8MjAwNC0xMC0xOT47Pj47Oz47dDxAMDw7Ozs7Ozs7Ozs7Pjs7Pjs+Pjs+Pjs+XspLqC08TG9eDdabrOOB2cJk9p0=
Group_RadioButtonList StartDate
txtPayment  
txtCashier  
ActiveDateTime3 632337408000000000
ActiveDateTime3_day 13
ActiveDateTime3_month 10
ActiveDateTime3_year 2004
ActiveDateTime4 632337408000000000
ActiveDateTime4_day 14
ActiveDateTime4_month 10
ActiveDateTime4_year 2004
btnRunQuery Run Query
Server Variables
Name Value
ALL_HTTP HTTP_CACHE_CONTROL:no-cache HTTP_CONNECTION:Keep-Alive HTTP_CONTENT_LENGTH:678 HTTP_CONTENT_TYPE:application/x-www-form-urlencoded HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:Polls_Question20=101; ASP.NET_SessionId=qce2ae45pv4tfl453op1sdzj HTTP_HOST:localhost HTTP_REFERER:http://localhost/MSPOS/Receipts.aspx HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)  
ALL_RAW Cache-Control: no-cache Connection: Keep-Alive Content-Length: 678 Content-Type: application/x-www-form-urlencoded Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* Accept-Encoding: gzip, deflate Accept-Language: en-us Cookie: Polls_Question20=101; ASP.NET_SessionId=qce2ae45pv4tfl453op1sdzj Host: localhost Referer: http://localhost/MSPOS/Receipts.aspx User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)  
APPL_MD_PATH /LM/W3SVC/1/Root/MSPOS
APPL_PHYSICAL_PATH C:\Inetpub\wwwroot\MSPOS\
AUTH_TYPE  
AUTH_USER  
AUTH_PASSWORD  
LOGON_USER  
REMOTE_USER  
CERT_COOKIE  
CERT_FLAGS  
CERT_ISSUER  
CERT_KEYSIZE  
CERT_SECRETKEYSIZE  
CERT_SERIALNUMBER  
CERT_SERVER_ISSUER  
CERT_SERVER_SUBJECT  
CERT_SUBJECT  
CONTENT_LENGTH 678
CONTENT_TYPE application/x-www-form-urlencoded
GATEWAY_INTERFACE CGI/1.1
HTTPS off
HTTPS_KEYSIZE  
HTTPS_SECRETKEYSIZE  
HTTPS_SERVER_ISSUER  
HTTPS_SERVER_SUBJECT  
INSTANCE_ID 1
INSTANCE_META_PATH /LM/W3SVC/1
LOCAL_ADDR 127.0.0.1
PATH_INFO /MSPOS/Receipts.aspx
PATH_TRANSLATED C:\Inetpub\wwwroot\MSPOS\Receipts.aspx
QUERY_STRING  
REMOTE_ADDR 127.0.0.1
REMOTE_HOST 127.0.0.1
REMOTE_PORT 4707
REQUEST_METHOD POST
SCRIPT_NAME /MSPOS/Receipts.aspx
SERVER_NAME localhost
SERVER_PORT 80
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/6.0
URL /MSPOS/Receipts.aspx
HTTP_CACHE_CONTROL no-cache
HTTP_CONNECTION Keep-Alive
HTTP_CONTENT_LENGTH 678
HTTP_CONTENT_TYPE application/x-www-form-urlencoded
HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE en-us
HTTP_COOKIE Polls_Question20=101; ASP.NET_SessionId=qce2ae45pv4tfl453op1sdzj
HTTP_HOST localhost
HTTP_REFERER http://localhost/MSPOS/Receipts.aspx
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)
0
 
LVL 7

Accepted Solution

by:
sukumar_diya earned 500 total points
ID: 12356517
hi,
Print the sql statement before executing it and paste it here.
That will help me to trace the error.
Sukumar
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now