473,805 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DataSo urce = 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.Ite m.FindControl(" txtSectionName" )).Text =
(String)System. Web.UI.DataBind er.Eval(e.Item. DataItem,"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 1318
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******@icomp asstech.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.DataSo urce = 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.Ite m.FindControl(" txtSectionName" )).Text =
(String)System. Web.UI.DataBind er.Eval(e.Item. DataItem,"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
3304
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 reference not set to an instance of an object". This error message commonly occurs when a server control is incorrecly declared, so naturally I have double checked this. To test this, I moved the aspx code for the DataGrid ('myNestedDataGrid')...
1
1180
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?? I'll really appreciate your help
3
2867
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 creating elements on the fly dynamically. I have a control that needs to display 3 columns and n number of rows depending on number of records. Sounds simple. But each Row has a control with its own data source binding and value must be selected...
1
1557
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 Header</td> </tr> <tr><td bgcolor="gray">SubHead1</td><td bgcolor="gray">Subhead2 -
4
5296
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 highlightCount as integer = 1 %>
1
1431
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 a Repeater. Can anybody give me an idea how to this in a Repeater or point me to some sample code? Thanks
4
5056
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, websites, MSDN and was not able to find something that would help me understand and code. I might not be searching for the right words or phrases. So if you know how to do this or know of links or websites that have information about this, please...
1
17050
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 control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
1
3324
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 users to enter new rows. I do this by showing them a blank row. The question I now have is: 1) In the new row, if the user supplies data to only 2 columns out of the three "required" columns, I want to do a validation and ask them to provide the...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10369
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.