Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Repeaters, Controls and Events

Thread Tools

Repeaters, Controls and Events

LandShark LandShark is offline
Junior Member
Join Date: Jul 2007
Location: Spokane WA for now
Posts: 1

I am trying to use a REPEATER to display data. I have added a button to my item template. The data displays fine, and the buttons show as expected. The problem is events. I load and bind the repeater in the page_load function and so whenever I click a button the entire table goes away along with all its goodies. And if I set a breakpoint in the repeaters event handler it never seems to get called. I have read many posts but cant seem to find exactly what I need. From what I gather the repeater has a view stat that should persist if you create the repeater in the page_load function, and the event should fire if you are checking for postback in the page_load function before you databind on the repeater. Here is some code for insight.

protected void Page_Load(object sender, EventArgs e)
if (IsPostBack)
SqlConnection conx = new SqlConnection(@"Initial Catalog=ATC_Prod;Data Source=localhost;User ID=matt;Password=snoochie;timeout=10");
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();

da.SelectCommand = new SqlCommand();

SqlParameter param1 = new SqlParameter();
SqlParameter param2 = new SqlParameter();
param1.ParameterName = "@customer";
param2.ParameterName = "@po";
param1.Value = DropDownList1.SelectedValue;
param2.Value = DropDownList2.SelectedValue;


da.SelectCommand.Connection = conx;
da.SelectCommand.CommandText = "Select distinct(PartNumber), count(PartNumber) from dbo.vw_order_statusAll WHERE Customer = @customer AND PO = @po GROUP BY PartNumber ORDER BY 1 DESC;";

da.Fill(ds, "vw_order_statusAll");
Repeater1.DataSource = ds.Tables[0];


<asp:Repeater id="Repeater1" OnItemCommand="Button_ItemCommand" runat="server">
<table border="1">
<tr style="background: beige">
<th>Part Number</th>
<th>WO Qty</th>
<th>Get #'s</th>
<tr style="background: white">
<td><%# DataBinder.Eval(Container.DataItem, "PARTNUMBER")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "Column1")%></td>
<td><asp:Button CommandName="ID" Text = "WO Nums" runat="server" /></td>
<tr style="background: beige">
<td><%# DataBinder.Eval(Container.DataItem, "PARTNUMBER")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "Column1")%></td>
<td><asp:Button CommandName="ID" Text = "WO Nums" runat="server" /></td>
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically adding controls with events (but events are not firing) SevDer ASP .Net 2 11-13-2007 06:33 AM
Linking events from controls, when the controls have been created =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?= ASP .Net 3 07-16-2007 04:02 PM
runtime events that generate other controls and events newbye ASP .Net 0 07-06-2006 06:27 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Child controls in Composite Controls not firing events David Boike ASP .Net Web Controls 0 08-07-2003 05:39 PM