473,491 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RegisterClientScriptBlock not updating

Hi,

I have a Page.RegisterClientScriptBlock in datagrid itemdatabound which
creates dynamic javascript arrays for each row generated. This works fine on
datagrid loads.
But when i did the sort on the datagrid, I see the same javascript arrays in
the pagesource (not the updated ones).
I am calling the databind in the grid sort command too and the Grid looks
good with the sorted items.

For eg:
Datagrid with no Sort:
Disp[0] = 'myname';

Datagrid with Sort:
Disp[0]='mynewsortedname';

But Disp[0] is still holding the old value in the page source.

code:
=====
private void Page_Load(object sender, System.EventArgs e)
{
if (!(IsPostBack))
{}
else
{
SortField = "firstname";
dgresults.DataSource = CreateDataSource();
dgresults.DataBind();
}
}

protected void dgresults_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item
||e.Item.ItemType==ListItemType.AlternatingItem)
{
Page.RegisterClientScriptBlock("ctxmenu"+e.Item.It emIndex.ToString(),ctxmenu.CreateMenu(Convert.ToIn t32(e.Item.ItemIndex),strDisp,strUrl));
}
}

public void dgresults_sort(object sender, DataGridSortCommandEventArgs e)
{
SortField = (string)e.SortExpression;
dgresults.Columns.Clear();
dgresults.DataSource = CreateDataSource();
dgresults.DataBind();
}

Thanks

Gane
Jun 9 '06 #1
0 950

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

Similar topics

2
1976
by: Earl Teigrob | last post by:
I have a Web Custom Control that builds javascript to write to the page. The DatePickerJs() function builds over 500 lines of javacript code. Even thought my Custom Web Control does not write it to...
6
6203
by: Rajan | last post by:
I have used RegisterClientScriptBlock in my ASP.NET page. it works well. Here I have problem. When Postback occurs, I dont want the script to be emitted. But It emits the Script even if I dont call...
2
3055
by: sam | last post by:
I am trying to emit script to the response stream within the Application_Error handler in global.asax. I want to emit using Page.RegisterClientScriptBlock. This doesn't work, and I have been...
1
3811
by: Simon Harris | last post by:
Hi All, I'm trying to write a composite web control which will render a rich text editor. I am having problems with RegisterClientScriptBlock - The script simply doesnt get written. There are...
1
3169
by: Jason Chan | last post by:
in asp.net 2.0, Page.RegisterClientScriptBlock is replaced by Client.RegisterClientScriptBlock function signature: Client.RegisterClientScriptBlock(Type, String, String) what should i put...
2
2790
by: kewl | last post by:
Hi All, We have an ASP.NET 2.0 (C#) intranet application that needs to spawn multiple browsers using RegisterClientScriptBlock. Here's what we got so far: // Go thru each datarow in the...
9
1359
by: Nathan Sokalski | last post by:
I have used the RegisterClientScriptBlock method in external functions of mine (ones that are saved in a separate *.vb file), where I use them as follows: Public Shared Sub MyFunction(ByVal...
4
12893
by: Nathan Sokalski | last post by:
I am working on converting my code from ASP.NET 1.1 to ASP.NET 2.0. In ASP.NET 1.1 the RegisterClientScriptBlock method was just a key and script (2 Strings), but in ASP.NET the...
3
6617
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
7115
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,...
0
7154
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,...
0
7360
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...
1
4881
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...
0
3086
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...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
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 ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.