473,569 Members | 2,761 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postback does maintain datagrid sort direction image ?

Hi, All:
I dynamic add an arrow up/down image in OnItemDataBound event for my
datagrid, it works fine. But I have another textbox which trigger
postback and doing something, after this event get executed, I lost the

image but the datagrid maintain the same sort order. Should the
datagrid remain what it looks like (with the riget arrow up/down image)

before the postback caused by the textbox?

I tried to get the datagrid header in the text postback event
(OnChanged), but I do not know how to get the datagrid header. I do not

want to rebind the datagrid in the textbox OnChanged event.
Or should I use other method to show the sort direction image?
private void dgrid_OnItemDat aBound(object sender,
System.Web.UI.W ebControls.Data GridItemEventAr gs e)
{
//Sorting Image
if(e.Item.ItemT ype == ListItemType.He ader)
{
foreach(TableCe ll tc in e.Item.Cells)
{
if(tc.Controls. Count > 0)
{
try
{
LinkButton lkbSortCol =
(System.Web.UI. WebControls.Lin kButton)tc.Cont rols[0];

if(lkbSortCol.C ommandArgument. ToString().Equa ls(dgrid.Attrib utes["SortExpre*ssio n"]))

{

System.Web.UI.W ebControls.Imag e imgSort = new
System.Web.UI.W ebControls.Imag e();

if(dgrid.Attrib utes["SortDirect ion"].Equals("DESC") )
{

imgSort.ImageUr l = Server.MapPath( "Images/sort_desc.gif") ;
}
else
{

imgSort.ImageUr l = Server.MapPath( "Images/sort_asc.gif");
}
tc.Controls.Add At(1,
imgSort);
}
}
catch(Exception ex)
{
Trace.Write(ex. Message);
}
}//end if tc.controls.cou nt > 0
}//end for
} //end item type
Thanks a lot
-Rockdale

Jun 8 '06 #1
0 1398

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

Similar topics

2
3179
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/creatingcustomcolumns.asp The problem I am having is that the data in the custom datagridcolumn is not saved to viewstate and after...
10
4487
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back (basically have the data binding done in the If NOT IsPostBack Then statement). How come? How does this information get preserved? Which raises...
1
4103
by: Lisa | last post by:
I have a web app that gets a recordset from the database and fills a grid. You can drilldown from this table to a detail table. Because the tables sometimes get huge, and because I have to go back to the database again every time I postback anyway, I wanted to disable ViewState in the grids. Just to minimize the amount of stuff that gets...
1
2165
by: darin_dimitrov | last post by:
I have an application which consists of 2 web forms. On the first page I have a datagrid with paging and sorting turned on. I also have a textbox which allows me to filter the data in the grid and narrow down the results. The grid also contains a column with hyperlinks which when clicked should invoke the second page which displays details...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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...
0
8120
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...
1
7672
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...
0
7968
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...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
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

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.