westdh
asked on
Remove duplicate items from Gridview - ASP.NET
I need a way to remove duplicate row in more than one column like columns 2 & 3
48 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport CALTROP Corporation landerson@CALTROP.com 25.00 agw 1/18/2010
56 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Russell A Moore jmramoore@yahoo.com 25.00 agw 1/20/2010
59 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport S&C Engineers andy_kleiber@scengineers.c om 25.00 agw 1/21/2010
62 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport KELLCO mailbox3137@kellcomacs.com 25.00 cmp 1/21/2010
83 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Susan Farrell Dina.Potter@jacobs.com 25.00 agw 1/22/2010
84 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.co m 25.00 agw 1/22/2010
85 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Arrow Acoustics Inc dave@arrowacoustics.com 25.00 agw 1/22/2010
87 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.co m 25.00 cmp 1/22/2010
88 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Eli Naor denise@vbnarch.com 25.00 agw 1/25/2010
89 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Summit Associates ken.rice@summticm.com 25.00 agw 1/25/2010
My code
========================
<%@ Page Language="VB" Debug="false" AutoEventWireup="false" CodeFile="EventSummaryRpt. aspx.vb" Inherits="wwwroot_EventSum maryRpt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="HTML1" runat="Server">
<head id="Head1" runat="Server">
<script runat="server">
Dim TotalUnitPrice As Decimal = 0.0
Function GetUnitPrice(ByVal fltOrderAmount As Decimal) As Decimal
TotalUnitPrice += fltOrderAmount
Return fltOrderAmount
End Function
Function GetTotal() As Decimal
Return TotalUnitPrice
End Function
</script>
</head>
<div align="center">
<body id="Body1" runat="server">
<table align="center">
<tr><td align="center"><strong><fo nt size="4">BOC Breakfast of Champions Registration PayPal Summary Report</font></strong></td ></tr>
<tr><td align="center"><font size="1">Print Instructions: Print in preview mode - Set to Landscape - Set Shrink Page to 85% - Click on Print preview.</font>
</td></tr>
<tr><td>
<form id="form1" runat="server">
<br />
Select Event Name:
<asp:DropDownList ID="DroplistData" runat="server" Width="440px" AutoPostBack="True" OnSelectedIndexChanged="Dr oplistData _SelectedI ndexChange d">
<asp:ListItem> </asp:ListItem>
</asp:DropDownList>
<br /><br />
Select Month:
<asp:DropDownList ID="ddlMth" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dd lMth_Selec tedIndexCh anged">
<asp:ListItem></asp:ListIt em>
<asp:ListItem Value="1">Jan</asp:ListIte m>
<asp:ListItem Value="2">Feb</asp:ListIte m>
<asp:ListItem Value="3">Mar</asp:ListIte m>
<asp:ListItem Value="4">Apr</asp:ListIte m>
<asp:ListItem Value="5">May</asp:ListIte m>
<asp:ListItem Value="6">Jun</asp:ListIte m>
<asp:ListItem Value="7">Jul</asp:ListIte m>
<asp:ListItem Value="8">Aug</asp:ListIte m>
<asp:ListItem Value="9">Sep</asp:ListIte m>
<asp:ListItem Value="10">Oct</asp:ListIt em>
<asp:ListItem Value="11">Nov</asp:ListIt em>
<asp:ListItem Value="12">Dec</asp:ListIt em>
</asp:DropDownList>
Select Year:
<asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dd lYear_Sele ctedIndexC hanged">
<asp:ListItem></asp:ListIt em>
<asp:ListItem Value="2010">2010</asp:Lis tItem>
<asp:ListItem Value="2011">2011</asp:Lis tItem>
<asp:ListItem Value="2012">2012</asp:Lis tItem>
<asp:ListItem Value="2013">2013</asp:Lis tItem>
<asp:ListItem Value="2014">2014</asp:Lis tItem>
<asp:ListItem Value="2015">2015</asp:Lis tItem>
<asp:ListItem Value="2016">2016</asp:Lis tItem>
<asp:ListItem Value="2017">2017</asp:Lis tItem>
<asp:ListItem Value="2018">2018</asp:Lis tItem>
<asp:ListItem Value="2019">2019</asp:Lis tItem>
<asp:ListItem Value="2020">2020</asp:Lis tItem>
<asp:ListItem Value="2021">2021</asp:Lis tItem>
<asp:ListItem Value="2022">2022</asp:Lis tItem>
<asp:ListItem Value="2023">2023</asp:Lis tItem>
<asp:ListItem Value="2024">2024</asp:Lis tItem>
<asp:ListItem Value="2025">2025</asp:Lis tItem>
</asp:DropDownList>
If you select a new event; reset the year.
<br />
<br />
<asp:GridView ID="uxItemDetailGrid" runat="server" ShowFooter="true" AutoGenerateColumns="false " HorizontalAlign="center" HeaderStyle-Height="40" CellPadding="2" BorderColor="#A1C1D9" GridLines="Both" RowStyle-Font-Size="8" width="900"
uxItemDetailGrid_RowDataBo und>
<HeaderStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" /><FooterStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" />
<Columns>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" ItemStyle-HorizontalAlign= "Center" HeaderText="Registration<b r>ID">
<ItemTemplate>
<asp:Label ID="lblintRegistrationID" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("intRegistrationID") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" ItemStyle-HorizontalAlign= "Center" HeaderText="Event<br>Date" >
<ItemTemplate>
<asp:Label ID="lblEventDate" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("dtmEvent","{0:d}") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Left" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Event<br>Title ">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strTitle") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Left" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Company<br>Nam e">
<ItemTemplate>
<asp:Label ID="lblstrName" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strName") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Left" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Company<br>Ema il">
<ItemTemplate>
<asp:Label ID="lblstrEmail" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strEmail") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Center" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Fee<br>Amount" >
<ItemTemplate>
<asp:Label ID="lblfltOrderAmount" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("fltOrderAmount","{0 :c}") %>'>
</asp:Label>
</ItemTemplate>
<ItemTemplate>
<%#GetUnitPrice(Decimal.Pa rse(Eval(" fltOrderAm ount").ToS tring())). ToString(" N2")%>
</ItemTemplate>
<FooterTemplate>
<%# GetTotal().ToString("N2") %>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Center" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Payment<br>Sta tus">
<ItemTemplate>
<asp:Label ID="lblblnEmailSent" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("strRegistrationStat usID") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign= "Center" HeaderStyle-BackColor="#A1 C1D9" HeaderStyle-Font-Size="9" HeaderText="Date<br>Regist ered">
<ItemTemplate>
<asp:Label ID="lbldtmCreated" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("dtmCreated","{0:d}" ) %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
</div>
<table>
<tr><td align="center">
<asp:Button ID="btnExportExcel" runat="server" Text="ExportToExcel" onclick="btnexportExcel_cl ick" />
</td></tr>
<tr><td align="center">
<asp:Button id="Button2" runat="server" text="Return to Event Registration" onclick="btnreturn_click" /></p>
</td></tr>
</table>
</form>
</td></tr>
</table>
</body>
</HTML>
========================== ========== =====
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls. WebParts
Imports System.Web.UI.HtmlControls
Partial Public Class wwwroot_EventSummaryRpt
Inherits System.Web.UI.Page
Private iRowsCount As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
'Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st rName,r.st rEmail,r.f ltOrderAmo unt,r.strR egistratio nStatusID, r.dtmCreat ed FROM i2Integration_EventRegv45_ Event e,i2Integration_EventRegv4 5_Registra tion r where e.intEventID = r.intEventID and r.strPaymentMethodID = 'pp' and ((r. strRegistrationStatusID = 'cmp') or (r.strRegistrationStatusID = 'agw')) Order by e.dtmEvent"
'Using sqlConn As New SqlConnection(Configuratio nManager.C onnectionS trings("Si teSqlServe r").Connec tionString )
'Using adapPatientBills As New SqlDataAdapter(strSelectCo mmand, sqlConn)
'adapPatientBills.Fill(dtV olumeOrder )
'End Using
'End Using
'uxItemDetailGrid.DataSour ce = dtVolumeOrder
'uxItemDetailGrid.DataBind ()
Dim dtVolumeOrder2 As New DataTable()
Dim strSelectCommand2 As String = "SELECT distinct(strTitle),intEven tID FROM i2Integration_EventRegv45_ Event order by intEventID"
Using sqlConn As New SqlConnection(Configuratio nManager.C onnectionS trings("Si teSqlServe r").Connec tionString )
Using adapPatientBills As New SqlDataAdapter(strSelectCo mmand2, sqlConn)
adapPatientBills.Fill(dtVo lumeOrder2 )
End Using
End Using
DroplistData.DataSource = dtVolumeOrder2
DroplistData.DataTextField = "strTitle"
DroplistData.DataBind()
End If
End Sub
Protected Sub uxItemDetailGrid_RowDataBo und(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
'switch for first row
If e.Row.RowIndex = 1 Then
Dim Gprev As GridViewRow = uxItemDetailGrid.Rows(e.Ro w.RowIndex - 1)
If Gprev.Cells(1).Text.Equals (e.Row.Cel ls(1).Text ) Then
e.Row.Cells(1).Text = ""
End If
End If
'now continue with the rest of the rows
If e.Row.RowIndex > 1 Then
'set reference to the row index and the current value
Dim intC As Integer = e.Row.RowIndex
Dim lookfor As String = e.Row.Cells(1).Text
'now loop back through checking previous entries for matches
Do
Dim Gprev As GridViewRow = uxItemDetailGrid.Rows(intC - 1)
If Gprev.Cells(1).Text.Equals (e.Row.Cel ls(1).Text ) Then
e.Row.Cells(1).Text = ""
End If
intC = intC - 1
Loop While intC > 0
End If
End If
End Sub
Protected Sub DroplistData_SelectedIndex Changed(By Val sender As Object, ByVal e As System.EventArgs)
'Dim dtVolumeOrder As New DataTable()
'Where strTitle = '" + DroplistData.SelectedValue + "'"
'Dim strSelectCommand As String = "SELECT strTitle FROM i2Integration_EventRegv45_ Event"
'Using sqlConn As New SqlConnection(Configuratio nManager.C onnectionS trings("Si teSqlServe r").Connec tionString )
'Using adapPatientBills As New SqlDataAdapter(strSelectCo mmand, sqlConn)
'adapPatientBills.Fill(dtV olumeOrder )
'End Using
'End Using
'DroplistData.DataSource = dtVolumeOrder
'DroplistData.DataTextFiel d = "strTitle"
'DroplistData.DataBind()
ddlYear.SelectedIndex = 0
End Sub
Protected Sub ddlMth_SelectedIndexChange d(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st rName,r.st rEmail, r.fltOrderAmount,r.strRegi strationSt atusID,r.d tmCreated FROM i2Integration_EventRegv45_ Event e,i2Integration_EventRegv4 5_Registra tion r where e.intEventID = r.intEventID and r.strPaymentMethodID = 'pp' and ((r.strRegistrationStatusI D = 'cmp') or (r.strRegistrationStatusID = 'agw')) and r.blnEmailSent=1 and (YEAR(e.dtmEvent) = '" + ddlYear.SelectedValue + "' AND MONTH(e.dtmEvent) = '" + ddlMth.SelectedValue + "' AND e.strTitle = '" + DroplistData.SelectedValue .Tostring. replace("' ","''") + "') Order by e.dtmEvent"
Dim strSelectCommand As String = "SELECT r.intRegistrationID, e.dtmEvent,e.strTitle,r.st rName,r.st rEmail, r.fltOrderAmount,r.strRegi strationSt atusID,r.d tmCreated FROM i2Integration_EventRegv45_ Event e,i2Integration_EventRegv4 5_Registra tion r, i2Integration_EventRegv45_ Registrati onUser u where e.intEventID = r.intEventID and r.strPaymentMethodID = 'pp' and r.intRegistrationID = u.intRegistrationID and(YEAR(e.dtmEvent) = '" + ddlYear.SelectedValue + "' AND MONTH(e.dtmEvent) = '" + ddlMth.SelectedValue + "' AND e.strTitle = '" + DroplistData.SelectedValue + "') Order by e.dtmEvent"
Using sqlConn As New SqlConnection(Configuratio nManager.C onnectionS trings("Si teSqlServe r").Connec tionString )
Using adapPatientBills As New SqlDataAdapter(strSelectCo mmand, sqlConn)
adapPatientBills.Fill(dtVo lumeOrder)
End Using
End Using
'iRowsCount = dtVolumeOrder.Rows.Count - 1
uxItemDetailGrid.DataSourc e = dtVolumeOrder
uxItemDetailGrid.DataBind( )
End Sub
Protected Sub ddlYear_SelectedIndexChang ed(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st rName,r.st rEmail, r.fltOrderAmount,r.strRegi strationSt atusID,r.d tmCreated FROM i2Integration_EventRegv45_ Event e,i2Integration_EventRegv4 5_Registra tion r where e.intEventID = r.intEventID and r.strPaymentMethodID = 'pp' and ((r.strRegistrationStatusI D = 'cmp') or (r.strRegistrationStatusID = 'agw')) and r.blnEmailSent=1 and (YEAR(e.dtmEvent) = '" + ddlYear.SelectedValue + "' AND MONTH(e.dtmEvent) = '" + ddlMth.SelectedValue + "' AND e.strTitle = '" + DroplistData.SelectedValue .Tostring. replace("' ","''") + "') Order by e.dtmEvent"
Dim strSelectCommand As String = "SELECT r.intRegistrationID, e.dtmEvent,e.strTitle,r.st rName,r.st rEmail, r.fltOrderAmount,r.strRegi strationSt atusID,r.d tmCreated FROM i2Integration_EventRegv45_ Event e,i2Integration_EventRegv4 5_Registra tion r, i2Integration_EventRegv45_ Registrati onUser u where e.intEventID = r.intEventID and r.strPaymentMethodID = 'pp' and r.intRegistrationID = u.intRegistrationID and(YEAR(e.dtmEvent) = '" + ddlYear.SelectedValue + "' AND MONTH(e.dtmEvent) = '" + ddlMth.SelectedValue + "' AND e.strTitle = '" + DroplistData.SelectedValue + "') Order by e.dtmEvent"
Using sqlConn As New SqlConnection(Configuratio nManager.C onnectionS trings("Si teSqlServe r").Connec tionString )
Using adapPatientBills As New SqlDataAdapter(strSelectCo mmand, sqlConn)
adapPatientBills.Fill(dtVo lumeOrder)
End Using
End Using
'iRowsCount = dtVolumeOrder.Rows.Count - 1
uxItemDetailGrid.DataSourc e = dtVolumeOrder
uxItemDetailGrid.DataBind( )
End Sub
Public Overloads Overrides Sub VerifyRenderingInServerFor m(ByVal control As Control)
' Verifies that the control is rendered
End Sub
Protected Sub OnPaging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
uxItemDetailGrid.PageIndex = e.NewPageIndex
uxItemDetailGrid.DataBind( )
End Sub
Protected Sub btnExportWord_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.Clear()
Response.Buffer = True
'For Word:
Response.AddHeader("conten t-disposit ion", "attachment;filename=dataf ile.doc")
Response.ContentType = "application/vnd.ms-word"
'For Excel Response.AddHeader("conten t-disposit ion", "attachment;filename=data. xls"); Response.ContentType = "application/vnd.ms-excel" ;
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter()
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWrit er(oString Writer)
uxItemDetailGrid.RenderCon trol(oHtml TextWriter )
Response.Write(oStringWrit er.ToStrin g())
Response.[End]()
End Sub
Protected Sub btnexportexcel_click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Clear()
Response.Buffer = True
'For Word:
'Response.AddHeader("conte nt-disposi tion", "attachment;filename=data. doc")
'Response.ContentType = "application/vnd.ms-word"
'For Excel
Response.AddHeader("conten t-disposit ion", "attachment;filename=Event data.xls")
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter()
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWrit er(oString Writer)
uxItemDetailGrid.RenderCon trol(oHtml TextWriter )
Response.Write(oStringWrit er.ToStrin g())
Response.[End]()
End Sub
Protected Sub btnreturn_click(ByVal sender As Object, ByVal e As System.EventArgs)
'Dim URL = "http://www.cmaanorcalevents.com/"
Response.Redirect("http://oaklandboc.com/dotnetnuke/") ' return to clients website
End Sub
End Class
48 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport CALTROP Corporation landerson@CALTROP.com 25.00 agw 1/18/2010
56 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Russell A Moore jmramoore@yahoo.com 25.00 agw 1/20/2010
59 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport S&C Engineers andy_kleiber@scengineers.c
62 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport KELLCO mailbox3137@kellcomacs.com
83 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Susan Farrell Dina.Potter@jacobs.com 25.00 agw 1/22/2010
84 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.co
85 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Arrow Acoustics Inc dave@arrowacoustics.com 25.00 agw 1/22/2010
87 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.co
88 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Eli Naor denise@vbnarch.com 25.00 agw 1/25/2010
89 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Summit Associates ken.rice@summticm.com 25.00 agw 1/25/2010
My code
========================
<%@ Page Language="VB" Debug="false" AutoEventWireup="false" CodeFile="EventSummaryRpt.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="HTML1" runat="Server">
<head id="Head1" runat="Server">
<script runat="server">
Dim TotalUnitPrice As Decimal = 0.0
Function GetUnitPrice(ByVal fltOrderAmount As Decimal) As Decimal
TotalUnitPrice += fltOrderAmount
Return fltOrderAmount
End Function
Function GetTotal() As Decimal
Return TotalUnitPrice
End Function
</script>
</head>
<div align="center">
<body id="Body1" runat="server">
<table align="center">
<tr><td align="center"><strong><fo
<tr><td align="center"><font size="1">Print Instructions: Print in preview mode - Set to Landscape - Set Shrink Page to 85% - Click on Print preview.</font>
</td></tr>
<tr><td>
<form id="form1" runat="server">
<br />
Select Event Name:
<asp:DropDownList ID="DroplistData" runat="server" Width="440px" AutoPostBack="True" OnSelectedIndexChanged="Dr
<asp:ListItem> </asp:ListItem>
</asp:DropDownList>
<br /><br />
Select Month:
<asp:DropDownList ID="ddlMth" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dd
<asp:ListItem></asp:ListIt
<asp:ListItem Value="1">Jan</asp:ListIte
<asp:ListItem Value="2">Feb</asp:ListIte
<asp:ListItem Value="3">Mar</asp:ListIte
<asp:ListItem Value="4">Apr</asp:ListIte
<asp:ListItem Value="5">May</asp:ListIte
<asp:ListItem Value="6">Jun</asp:ListIte
<asp:ListItem Value="7">Jul</asp:ListIte
<asp:ListItem Value="8">Aug</asp:ListIte
<asp:ListItem Value="9">Sep</asp:ListIte
<asp:ListItem Value="10">Oct</asp:ListIt
<asp:ListItem Value="11">Nov</asp:ListIt
<asp:ListItem Value="12">Dec</asp:ListIt
</asp:DropDownList>
Select Year:
<asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dd
<asp:ListItem></asp:ListIt
<asp:ListItem Value="2010">2010</asp:Lis
<asp:ListItem Value="2011">2011</asp:Lis
<asp:ListItem Value="2012">2012</asp:Lis
<asp:ListItem Value="2013">2013</asp:Lis
<asp:ListItem Value="2014">2014</asp:Lis
<asp:ListItem Value="2015">2015</asp:Lis
<asp:ListItem Value="2016">2016</asp:Lis
<asp:ListItem Value="2017">2017</asp:Lis
<asp:ListItem Value="2018">2018</asp:Lis
<asp:ListItem Value="2019">2019</asp:Lis
<asp:ListItem Value="2020">2020</asp:Lis
<asp:ListItem Value="2021">2021</asp:Lis
<asp:ListItem Value="2022">2022</asp:Lis
<asp:ListItem Value="2023">2023</asp:Lis
<asp:ListItem Value="2024">2024</asp:Lis
<asp:ListItem Value="2025">2025</asp:Lis
</asp:DropDownList>
If you select a new event; reset the year.
<br />
<br />
<asp:GridView ID="uxItemDetailGrid" runat="server" ShowFooter="true" AutoGenerateColumns="false
uxItemDetailGrid_RowDataBo
<HeaderStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" /><FooterStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" />
<Columns>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" HeaderStyle-BackColor="#A1
<ItemTemplate>
<asp:Label ID="lblintRegistrationID" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("intRegistrationID") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" HeaderStyle-BackColor="#A1
<ItemTemplate>
<asp:Label ID="lblEventDate" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("dtmEvent","{0:d}") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strTitle") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lblstrName" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strName") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lblstrEmail" runat="server" BackColor = "#F4F4F4"
Text='<%# Eval("strEmail") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lblfltOrderAmount" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("fltOrderAmount","{0
</asp:Label>
</ItemTemplate>
<ItemTemplate>
<%#GetUnitPrice(Decimal.Pa
</ItemTemplate>
<FooterTemplate>
<%# GetTotal().ToString("N2") %>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lblblnEmailSent" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("strRegistrationStat
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-BackColor = "#F4F4F4" ItemStyle-HorizontalAlign=
<ItemTemplate>
<asp:Label ID="lbldtmCreated" runat="server" BackColor = "#F4F4F4"
Text='<% #Eval("dtmCreated","{0:d}"
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
</div>
<table>
<tr><td align="center">
<asp:Button ID="btnExportExcel" runat="server" Text="ExportToExcel" onclick="btnexportExcel_cl
</td></tr>
<tr><td align="center">
<asp:Button id="Button2" runat="server" text="Return to Event Registration" onclick="btnreturn_click" /></p>
</td></tr>
</table>
</form>
</td></tr>
</table>
</body>
</HTML>
==========================
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.
Imports System.Web.UI.HtmlControls
Partial Public Class wwwroot_EventSummaryRpt
Inherits System.Web.UI.Page
Private iRowsCount As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
'Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st
'Using sqlConn As New SqlConnection(Configuratio
'Using adapPatientBills As New SqlDataAdapter(strSelectCo
'adapPatientBills.Fill(dtV
'End Using
'End Using
'uxItemDetailGrid.DataSour
'uxItemDetailGrid.DataBind
Dim dtVolumeOrder2 As New DataTable()
Dim strSelectCommand2 As String = "SELECT distinct(strTitle),intEven
Using sqlConn As New SqlConnection(Configuratio
Using adapPatientBills As New SqlDataAdapter(strSelectCo
adapPatientBills.Fill(dtVo
End Using
End Using
DroplistData.DataSource = dtVolumeOrder2
DroplistData.DataTextField
DroplistData.DataBind()
End If
End Sub
Protected Sub uxItemDetailGrid_RowDataBo
If e.Row.RowType = DataControlRowType.DataRow
'switch for first row
If e.Row.RowIndex = 1 Then
Dim Gprev As GridViewRow = uxItemDetailGrid.Rows(e.Ro
If Gprev.Cells(1).Text.Equals
e.Row.Cells(1).Text = ""
End If
End If
'now continue with the rest of the rows
If e.Row.RowIndex > 1 Then
'set reference to the row index and the current value
Dim intC As Integer = e.Row.RowIndex
Dim lookfor As String = e.Row.Cells(1).Text
'now loop back through checking previous entries for matches
Do
Dim Gprev As GridViewRow = uxItemDetailGrid.Rows(intC
If Gprev.Cells(1).Text.Equals
e.Row.Cells(1).Text = ""
End If
intC = intC - 1
Loop While intC > 0
End If
End If
End Sub
Protected Sub DroplistData_SelectedIndex
'Dim dtVolumeOrder As New DataTable()
'Where strTitle = '" + DroplistData.SelectedValue
'Dim strSelectCommand As String = "SELECT strTitle FROM i2Integration_EventRegv45_
'Using sqlConn As New SqlConnection(Configuratio
'Using adapPatientBills As New SqlDataAdapter(strSelectCo
'adapPatientBills.Fill(dtV
'End Using
'End Using
'DroplistData.DataSource = dtVolumeOrder
'DroplistData.DataTextFiel
'DroplistData.DataBind()
ddlYear.SelectedIndex = 0
End Sub
Protected Sub ddlMth_SelectedIndexChange
Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st
Dim strSelectCommand As String = "SELECT r.intRegistrationID, e.dtmEvent,e.strTitle,r.st
Using sqlConn As New SqlConnection(Configuratio
Using adapPatientBills As New SqlDataAdapter(strSelectCo
adapPatientBills.Fill(dtVo
End Using
End Using
'iRowsCount = dtVolumeOrder.Rows.Count - 1
uxItemDetailGrid.DataSourc
uxItemDetailGrid.DataBind(
End Sub
Protected Sub ddlYear_SelectedIndexChang
Dim dtVolumeOrder As New DataTable()
'Dim strSelectCommand As String = "SELECT e.dtmEvent,e.strTitle,r.st
Dim strSelectCommand As String = "SELECT r.intRegistrationID, e.dtmEvent,e.strTitle,r.st
Using sqlConn As New SqlConnection(Configuratio
Using adapPatientBills As New SqlDataAdapter(strSelectCo
adapPatientBills.Fill(dtVo
End Using
End Using
'iRowsCount = dtVolumeOrder.Rows.Count - 1
uxItemDetailGrid.DataSourc
uxItemDetailGrid.DataBind(
End Sub
Public Overloads Overrides Sub VerifyRenderingInServerFor
' Verifies that the control is rendered
End Sub
Protected Sub OnPaging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
uxItemDetailGrid.PageIndex
uxItemDetailGrid.DataBind(
End Sub
Protected Sub btnExportWord_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.Clear()
Response.Buffer = True
'For Word:
Response.AddHeader("conten
Response.ContentType = "application/vnd.ms-word"
'For Excel Response.AddHeader("conten
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter()
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWrit
uxItemDetailGrid.RenderCon
Response.Write(oStringWrit
Response.[End]()
End Sub
Protected Sub btnexportexcel_click(ByVal
Response.Clear()
Response.Buffer = True
'For Word:
'Response.AddHeader("conte
'Response.ContentType = "application/vnd.ms-word"
'For Excel
Response.AddHeader("conten
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter()
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWrit
uxItemDetailGrid.RenderCon
Response.Write(oStringWrit
Response.[End]()
End Sub
Protected Sub btnreturn_click(ByVal sender As Object, ByVal e As System.EventArgs)
'Dim URL = "http://www.cmaanorcalevents.com/"
Response.Redirect("http://oaklandboc.com/dotnetnuke/") ' return to clients website
End Sub
End Class
48 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport CALTROP Corporation landerson@CALTROP.com 25.00 agw 1/18/2010
56 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Russell A Moore jmramoore@yahoo.com 25.00 agw 1/20/2010
59 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport S&C Engineers andy_kleiber@scengineers.com 25.00 agw 1/21/2010
62 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport KELLCO mailbox3137@kellcomacs.com 25.00 cmp 1/21/2010
83 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Susan Farrell Dina.Potter@jacobs.com 25.00 agw 1/22/2010
84 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.com 25.00 agw 1/22/2010
85 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Arrow Acoustics Inc dave@arrowacoustics.com 25.00 agw 1/22/2010
87 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Mabel Cater mcater@mcguireandhester.com 25.00 cmp 1/22/2010
88 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Eli Naor denise@vbnarch.com 25.00 agw 1/25/2010
89 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Summit Associates ken.rice@summticm.com 25.00 agw 1/25/2010
90 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Julie K. Morgan j.morgan@fehrandpeers.com 25.00 agw 1/25/2010
93 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Anthony Thompson thompsona@bankofalameda.com 25.00 agw 1/25/2010
94 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Paul J Krupka paul.krupka@kimley-horn.com 25.00 agw 1/25/2010
this would take time
The problem is obviously Oakland Airport. Either use SFO or Sacramento.
Sorry, couldn't resist. I have a lot of family out there, and being a KC Chiefs fan anything Oakland is bad.
Hopefully you get a chuckle. I don't mean to make light of your code problem.
Sorry, couldn't resist. I have a lot of family out there, and being a KC Chiefs fan anything Oakland is bad.
Hopefully you get a chuckle. I don't mean to make light of your code problem.
ASKER
I need to know why my routine is not removing either the date or the event
I have uxItemDetailGrid_RowDataBo und in the grid and the proc in the codebehind
'1/28/2010' or 'Breakfast of Champions - Franciscos Restaurant near Oakland Airport'
48 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport CALTROP Corporation landerson@CALTROP.com 25.00 agw 1/18/2010
56 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Russell A Moore jmramoore@yahoo.com 25.00 agw 1/20/2010
59 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport S&C Engineers andy_kleiber@scengineers.c om 25.00 agw 1/21/2010
62 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport
I have uxItemDetailGrid_RowDataBo
'1/28/2010' or 'Breakfast of Champions - Franciscos Restaurant near Oakland Airport'
48 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport CALTROP Corporation landerson@CALTROP.com 25.00 agw 1/18/2010
56 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport Russell A Moore jmramoore@yahoo.com 25.00 agw 1/20/2010
59 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport S&C Engineers andy_kleiber@scengineers.c
62 1/28/2010 Breakfast of Champions - Franciscos Restaurant near Oakland Airport
i don't think any body has time to read whole code to comment on it. would you mind giving a short description of problem and a short code snippet.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.