By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,649 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,649 IT Pros & Developers. It's quick & easy.

A strange issue!

P: n/a
I have a repeater that displays records from a database.

All fairly straight forward with the repeater binding to a dataset, and a
datacommand filling the dataset from the database. The only complication is
that the data displayed can come from either of two stored procedures
according to a checkbox selection. If you check the checkbox the page uses
one data command to get data from the database and if you don't check the
checkbox then the page uses a different datacommand to provide a different
set of data but to the same dataset. Both sets of data fit the same template
and therefore is correctly laid out by the repeater (in fact the data comes
from the same database table).

The complication is that one of the fields in the repeater is a textbox with
the Text value bound to the date value from the dataset. As a result the
repeater provides the date value in the text box (which can later be used
for editing).

<asp:repeater id="repJobs" runat="server" enableviewstate="False"
onitemcommand="Job_Detail" DataMember="LiveJobs" DataSource="<%# dsManJobs
%>">
<itemtemplate>
<tr>
<td><asp:linkbutton id="link" runat="server" commandname="JobID"
commandargument='<%# DataBinder.Eval(Container, "DataItem.JobID") %>' >
<asp:Literal ID="litID" Text='<%# DataBinder.Eval(Container,
"DataItem.JobID") %>' Runat="server" ></asp:Literal></asp:linkbutton></td>
<td><%# DataBinder.Eval(Container, "DataItem.Title") %></td>
<td class="right"><%# DataBinder.Eval(Container, "DataItem.Name") %></td>
<td class="center"><asp:TextBox id="txtMassDate" runat="server" Width="75px"
Text='<%# DataBinder.Eval(Container, "DataItem.AddStop", "{0:d/MM/yyyy}")
%>'></asp:TextBox></td>
<td class="center"><asp:CheckBox id="chkDelete"
runat="server"></asp:CheckBox></td></tr>
</itemtemplate>
<headertemplate></headertemplate>
<footertemplate></table></footertemplate>
</asp:repeater>

The problem is that although when you load the first set of data, everything
works correctly with the correct dates displayed, when you then check the
checkbox and repost the page to view the alternative data the dates in the
textbox's displayed are those from the earlier page? I know the data in the
dataset is correct as when i bind a datagrid to the same dataset the data in
the grid is displayed with the correct dates for either set of data etc. I
have tried turning off the viewstate on the checkbox but this doesn't appear
to make any difference!

Any suggestions?

Martyn Fewtrell
mf*******@networkclub.co.uk
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This is a silly question but do have a Page.IsPostBack check around your Databind() method in page_load? Because if you do have that and then don't rebind your repeater on postback, like in the checkbox.OnClick event, it won't be getting rebound

-J
Nov 18 '05 #2

P: n/a
Thanks for your input - know question is to silly!

There is a page is post back clause that chooses the appropriate routine to
run to load the correct data into the dataset according to the checkbox
selection. The repeater is then bound to the dataset. I assume anyway that
if this was not the case then the other elements in the repeater like the
link button and the name wouldn't load correctly and these do all display
the correct data and function correctly.

I assume that the issue is something to do with the binding on the textbox
(something that I haven't done before in this context).

Martyn Fewtrell
mf*******@networkclub.co.uk
"John Linn" <an*******@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
This is a silly question but do have a Page.IsPostBack check around your Databind() method in page_load? Because if you do have that and then don't
rebind your repeater on postback, like in the checkbox.OnClick event, it
won't be getting rebound.
-J

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.