.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Differences between RegisterClientScriptBlock & RegisterStartupScript and how they work with AJA

Posted By: codenickel     Posted Date: April 10, 2011    Points: 0   Category :ASP.Net
The article Differences between RegisterClientScriptBlock & RegisterStartupScript and how they work with AJAX Update Panel was added by codenickel on Sunday, January 23, 2011.

Differences between RegisterClientScriptBlock & RegisterStartupScript:-We usually write the javascript functions on aspx page. If we want dynamic script then we can not write on aspx page because in many cases like script may require some data from

View Complete Post

More Related Resource Links

Page.ClientScript.RegisterClientScriptBlock does not work

All, I am new to .Net and webpart. What I try to do is to create a griedview webpart with a functionality of export to excel. The gridview also can drildown another gridview. The drilldown work as expected. When click export to excel link button it works ok, too. The problem is when comeing back to the gridview to click any row, it stops to drilldown. If I want to use export to excel link it stop working also. Only refresh page can make it work again. I did research and found a solution, that is, to implement a javascript to solve the problem. I follow references from microsoft site as shown below. But it never works. Can anyone tell me what wrong I did? Thanks a lot   private const string ByeByeIncludeScriptKey = "myByeByeIncludeScript"; private const string EmbeddedScriptFormat = "<script type='text/javascript'>function ClientScript(){ _spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;}</script> "; //Constructor  public DataViewer() {  public DataViewer()this.PreRender += new EventHandler(DataViewer_PreRender); } //Client Script registration   private void DataViewer_PreRender(object sender, System.EventArgs e) { if (!this.Page.ClientScript.IsClientScriptBlockRegistered(ByeByeIncludeScriptKey))this.Page.ClientScript.RegisterClientScriptBlock(typeof(DataViewer), ByeByeI

Modal Popup does not work with ScriptManager.RegisterStartupScript


Ok, here is my problem, I am using a masterpage that contains a javascript script (does not matter what it does) and on each page under that masterpage I am registering that script to run on page load. On the page under the masterpage, I am calling a modalpopupextender to display on a button click. Now, if I disable the register startupscript, the popup extender works fine, if I register the startup up script it does not

here is the script regster call

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "addscript", "miscscript()", True)

I have also tried this

Page.ClientScript.RegisterStartupScript(Me.GetType(), "addScript", "miscscript()", True)

I had this working fine using the second example when using .net 4 and the Ajax toolkit for 4 but I am now having to rollback to 3.5 due to a vendor requirement.

any help would be appreciated as I am completely stumped by this behavior.

Here is a little bit of extra info:

If I put the script in page and not in the masterpage and just run with a window.onload, both work fine, which is why I have figured that it must be something that I am doing with the registration of the script.

When I say it does not matter what I put as the sript, I mean, it can be a complex element property adjustment or a simple alert, n

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Looking for guidance: wanting to work with AJAX architecture



I'm starting a small website that will be backed by a database, and will allow a small number of users to authenticate and select an entry in the database, and then view (and optionally update) a corresponding entry (think master-detail).

I have some flexibility in how I'll do this, but I'd really like to incorperate some newer AJAX style coding, eliminating some page postbacks. I think this is a great opportunity to learn the concepts well.

I'll probably go with an ASP.NET 4.0 site. From what I've seen there are MANY ways to go about this:

-WCF Data Services to expose the data, and consume in ASP.NET

-Page methods to expose the data, separate method to update the data

-I'd rather avoid the UpdatePanel because I'm really looking for a full hands-on approach, with learning client side scripting being an objective as well.

Beyond that, it seems that one can use jQuery to build clientside templates, but also one can use the ASP.NET AJAX template engine (in ASP.NET 4.0 I believe).

A concern I have: users should only be able to work with the data exposed via these endpoints if they are logged into the website. Hopefully I can somehow reuse the ASP.NET forms authentication cookie for this purpose. 

Well, I hope I've posted enough to a

animate effect work but the render items are messed up.


Hi all,

     I have a very unique problem, humm i think. I am using a jquery effect that animate bounce effect, i have a line in my javascript pageLoad function $("#UserBrowserInfoDIV").show('bounce'); - the effects run smoothly but what it does is mess up the bolded text in the div. I have try the items inside the div without bolding and it works fine and no render problem but when bolded the text that are bolded is quite messed up, and barely readable.

Please let me know is there anything else i can do i really would like use this effect.

P.S all the effect have the same render problem, and i am using ie8 under compatibility mode.





Why getTreeNode does not work?



I try to run a  treeview example from msdn:


I also want to use code from


Here is my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register TagPrefix="mytree"
Assembly="Microsoft.Web.UI.WebControls" %>
 <script type="text/javascript" language="javascript">

     function xxx() {

         var myNode = treeview_one.getTreeNode(treeview_one.selectedNodeIndex);


<form id="myform" runat="server">
<mytree:treeview id="treeview_one"  runat="server" Child

Category attribute of user control property does not work correctly in categories tab.



I have a User Control (ascx) and a property which a want to display in my categories tab in Visual Studio in the category named "Styles".

[Category("Styles"), DefaultValue(""), Description("The value for formating something.")]
public String MyFormatProperty
set { /* the code for set */; }
get { /* the code for get */; }

And here is the problem: Actually I do not need a get, because I only have to set the property (write only property). But when I omit the get, the property is displayed in the "Misc" category in the categories tab in Visual Studio. Only when I code the get as well, then the property is displayed correctly in the "Styles" category in the categories tab in Visual Studio.

Does anybody know why? How can I display the category correctly only with set?

Thanks, S.

Team System: Customizing Work Items


Team Foundation Server's work iIem tracking system provides a number of advanced customization options.This article explores custom control support that lets you link to date, enhance the user experience, present data, and more.

Brian A. Randell

MSDN Magazine October 2009

Peer Fun: A Peer-To-Peer Work Processing App With WCF


We demonstrate creating a peer-to-peer processing platform where multiple players function together for a common purpose: getting your work done.

Matt Neely

MSDN Magazine June 2009

Patterns in Practice: The Unit Of Work Pattern And Persistence Ignorance


Jeremy Miller continues his discussion of persistence patterns by reviewing the Unit of Work design pattern and examining the issues around persistence ignorance.

Jeremy Miller

MSDN Magazine June 2009

{ End Bracket }: Don't Be Afraid To Throw Away Your Work


With today's processing power at your disposal, Josh Phillips recommends speculative computation-performing operations ahead of time even if you may never need the results.

Josh Phillips

MSDN Magazine October 2008

Team System: Work Items and Undo Support


Add support for work items to the Team Foundation Server version control add-in.

Brian A. Randell

MSDN Magazine September 2007

Team System: Work Item Tracking


In this column, Brian Randell explains how to build a simple Work Item explorer and demonstrates the core operations needed to add work item support when building your own add-in.

Brian A. Randell

MSDN Magazine April 2007

C++ at Work: Rationales, Highlights, and a Farewell


What's the deal with const functions, and lots more on the reasoning behind the design of the C++/CLI.

Paul DiLascia

MSDN Magazine February 2007

C++ at Work: IRegistrar, Finding Submenus, and More


This month DLL problems, context menus, MFC strings to managed C++, and more.

Paul DiLascia

MSDN Magazine October 2006

C++ at Work: Create Dynamic Dialogs, Satellite DLLs, and More


This month Paul DiLascia teaches readers the right way to create dynamic dialogs, explains satellite DLLs and discusses language resource DLLs.

Paul DiLascia

MSDN Magazine September 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend