473,378 Members | 1,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Repeater Control / DataGrid / Row[] help

I'm having the issue is when I re-bind my repeater to show the changes
done to it from the code behind.

I'm binding this repeater from a DataTable that is stored in the
ViewState for now. It might change later, but that's where I'm gettting
it from.

I have an Image Button that allows users to move a Record Up one space
(order).

My Code grabs the DataTable from the ViewState, does the changes (which
work correctly), then procedes to bind the DataTable to the Repeater.

It works all find and dandy, but it doesn't change the order. THis is
because the acual order of the rows hasn't changed at all.

So I decide to do:

Repeater.DataSource = tblTemp.Select("Order > 0","ORDER DESC");

This works, but all the column headers are now gone, and I can't do any
binding like:

((TextBox)e.Item.FindControl("txtSectionName")).Te xt =
(String)System.Web.UI.DataBinder.Eval(e.Item.DataI tem,"Name");
Seeing the .Select of the DataGrid returns an array of Rows, is there
any other way of doing this asside from creating a brand new DataTable
from the array of rows?
/RT
Nov 19 '05 #1
1 1302
Ryan,

I think you should look at DataTable's PrimaryKey property. Ideally you
should have a column holding the row's order. Make it to the primary key.
When you want to change the order, you will just re-calculate the column
value for every row and re-databind. The repeater should pick up the new
order.

Eliyahu

"Ryan Ternier" <rt******@icompasstech.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm having the issue is when I re-bind my repeater to show the changes
done to it from the code behind.

I'm binding this repeater from a DataTable that is stored in the
ViewState for now. It might change later, but that's where I'm gettting
it from.

I have an Image Button that allows users to move a Record Up one space
(order).

My Code grabs the DataTable from the ViewState, does the changes (which
work correctly), then procedes to bind the DataTable to the Repeater.

It works all find and dandy, but it doesn't change the order. THis is
because the acual order of the rows hasn't changed at all.

So I decide to do:

Repeater.DataSource = tblTemp.Select("Order > 0","ORDER DESC");

This works, but all the column headers are now gone, and I can't do any
binding like:

((TextBox)e.Item.FindControl("txtSectionName")).Te xt =
(String)System.Web.UI.DataBinder.Eval(e.Item.DataI tem,"Name");
Seeing the .Select of the DataGrid returns an array of Rows, is there
any other way of doing this asside from creating a brand new DataTable
from the array of rows?
/RT

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
1
by: Marco Antonio Montalvo Durán | last post by:
hello everybody!!!, I made a list of links to different URL's using a Repeater. what I'm trying to do is to get the position in the repeater where clicked. Does somebody know how can I do it??...
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
1
by: JD | last post by:
Hello Everyone, I am trying to do a page where when the user gets to the page it will look very similar to the following: <table border=1> <tr> <td bgcolor="green" colspan="2">Main...
4
by: darrel | last post by:
I have a repeater that I'd like to apply some logic to, namly highlighting the top few items in the repeater. To do this, I need to determine the record count. I've tried this: <% dim...
1
by: Hans Merkl | last post by:
Hi, I must be missing something here. In a DataList and DataGrid I can use the property DataKeys to identify the selected element and get to its values. But I can't find a way to do the same in...
4
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup,...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
1
by: Ganesh Muthuvelu | last post by:
Hello, I am using a Repeater control to display data and also allow data editing. I simply have text boxes in my repeater template and allow the user to make changes as needed.. I also allow...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.