.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

all validators programatically executed when page is loaded

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net

Can i run all validators when page is loaded. I need to show * in all input text fields that are necessary. I have require field validators for that fields, can i run it by default when page is loaded?

View Complete Post

More Related Resource Links

How to process data AFTER page is completely loaded for the user?


I have some logging that has to be done, which are some database update or inserts.

However this logging is of no importance to the user, so I only want to process the data/logs after the page is completed for the user.
As of now, if I process the data while the page is loading, I go from 1.4 to 2.0 speed (server side time processing of code), which is quite a bit comparing it is of no use to the user.

So I want this code only executed after that the page is complete.

I've been checking out Ajax, async pages etc, but the problem is it still gets executed before the page is rendered to the client, which means the client will have to wait longer then it is not being processed.

I've been checking out Threadpool.queueBackgroundWorker, however if I get it correct, this will still be executed before the page is shown to the user, as it has to complete before the prerender.

Then I thought about creating a new thread, and do the processing there, which would not have my page waiting to complete the data/logging.
However when I have 100 or 200 users loading pages at the same time, then that would mean I would be creating 200 threads on those loads, which I doubt will be good for performance. So if I want to solve this, I would have to create my own threadpool and only assign for example a max of 40 threads to it which can pr

Performance - page is being loaded for the first time vs SubSequent Request

Hello, I have some serious performance Issues with  Windows controls loading first time on IE Browser then subsequent request's. When ever i open Browser first time , mywebsite takes 7 seconds to load, but on subsequent request  without closing browser it loads with-in 2 seconds.I Knew IIS on first time it re-compiles the process and for subsequent request's  it wont perform and it cahches .I'm looking for better  options to improve performance,  when ever  first time reqest's  comes to web server. On IIS 7  Server,I was using both Dynamic and Static compression enabled.Also,On application pool ,I set "ShutDown Time(Limit)" and "Startup Time(Limit") to 90 (seconds).Here is web.config i disable below to improve performance issues.   <trace enabled="false" pageOutput="false" />    <compilation debug="false"/>   Here is the Server Configuration Windows 2008 ServerIIS 7 64   bit Upto Date patches..Net Framework  2.0,3.0,3.5   Need   inputs to improve performance when user call website for  first time...

programatically add link in site settings page through feature


Hi folks,

          Im newbie in SharePoint, we have created an Application  Page for Managing the WebPart Permissions. We need to add one link called "ManageWebParts"  in the site settings Page so that  the admin can go the site settings and  Navigate to the ManageWebpart.aspx Page using this link. How we can  add the link  through programatically using feature???


Your thoughts??



Thanks & regards


Set custom publishing page layout custom field programatically


I have a custom publishing page content type, based on the Publishing Article Page content type. On this content type, I have a custom field named "PageContentCategory". In my code to create new pages, I tried this:


PublishingPage newPublishingPage = this.currentPublishingWeb.GetPublishingPages().Add(pageName, newPageSelectedLayout);

if (pageContent.IsEmpty())
 pageContent = Properties.Resources.EAWorldArticleHandler_CreateNewArticlePage_DefaultPageContent;

newPublishingPage.ListItem[new Guid("{93496B35-7EC3-4132-B0D0-3BDC5606F5EF}")] = pageContentCategory;
newPublishingPage.ListItem[FieldId.PublishingPageContent] = pageContent;
newPublishingPage.Title = pageTitle;


I have also tried to set it by the field name:


PublishingPage newPublishingPage = this.currentPublishingWeb.GetPublishingPages().Add(pageName, newPageSelectedLayout);

Displaying waiting image when page is loaded in asp.net



I want to display gif image when a page is loaded...

I have a dropdown list when this is selected Gridview is populated with data from database..

I want to show a gif image when this gridview is populated...

how to implement this without AJAX...





Run code on page loaded?



I have a MVC view that contains some dropdowns like this :

            <%: Html.DropDownListFor(model => model.CS.C1, Model.CS.Category1List, "-- Välj kategori --")%>
            <%: Html.DropDownListFor(model => model.CS.C2, Model.CS.Category2List, "-- Välj kategori --")%>
            <%: Html.DropDownListFor(model => model.CS.C3, Model.CS.Category3List, "-- Välj kategori --")%>
            <%: Html.DropDownListFor(model => model.CS.C4, Model.CS.Category4List, "-- Välj kategori --")%>
            <%: Html.DropDownListFor(model => model.CS.C5, Model.CS.Category5List, "-- Välj kategori --")%>
            <%: Html.DropDownListFor(model => model.CS.C6, Model.CS.Category6List, "-- Välj kategori --")%>

To compliment this with AJAX calls (to create CascadingDropDown) I have the following javascript :

$(document).ready(function () {
                $("#CS_C1").change(function () { lastCategoryId = $("#CS_C1").val() });
                $("#CS_C2").change(function () { lastCategoryId = $("#CS_C2").val() });
                $("#CS_C3").change(function () { lastCategoryId = $(&

Creating MS Word Document programatically in sharepoint foundation as Link Button on Master Page?



Can any body help me how to create a new document programatically for OnClick of  a LinkButton on my Homepage  as per the requirement.

I had installed MS OfficeWebApps on my Development Server which its working fine but the "Create Document " is on Top Ribbon for which the link should be on the right side of the Content Page of Home.Aspx as per the req.

Pls guide me how to achieve this.


Thanks in Advance !!!!




Thanks in Advance !!! Cheers !!! Praveen

Load gridviews after page has been loaded


I am trying to have the page fully load up and then after that load my gridviews as they take some time to generate..

Right now I do it with a timer and an update panel with the timer being set to 1 second which works perfectly fine but..

I don't want the page to be using the update panel when they click any button on it etc., I want it to function as a regular page.  What is the solution to this?

Another question is.. If i want to use this layout for multiple pages, what is the best way to do it so later on if I decide to change something in the layout I wouldn't have to go through all of these pages just to change 1 item.

Dynamically Loaded UserControl, receiving the click event from UserControl to Parent Page



   In a page , when I click a button 'showDialog' I am loading the user control dynamically in a dialog.  I am linking to the event in the user control as explained below. The parent page is not receiving this event.

  ex: (This is in the page class)


         UseControl1 gc = dlg.LoadContent(:\UserControl1.csx);

        gc.CausePostback += new EventHandler(execute_CausePostback());



   // I am trying to update the details grid in parent page


In UserControl class after clicking the submit button


  raise event CausePostBack();


Any help is appreciated.



Changing the master page and Css of SharePoint Site programatically

Hi All,

I am trying to change the Site Collection's Master page and alternative css  programatically. Below is the code I am using:


SPWeb spWeb = SPContext.Current.Web;

spWeb.AllowUnsafeUpdates =


spWeb.CustomMasterUrl = spWeb.CustomMasterUrl.Replace(

"default", "NewMaster");

spWeb.MasterUrl = spWeb.MasterUrl.Replace(


Page.Validators property


Hello ,

I have the following problem:

Here is the server side code :

 void Page_PreRender()
            foreach (RequiredFieldValidator valcontrol in Page.Validators)
                WebControl assControl = (WebControl)Page.FindControl(valcontrol.ControlToValidate);
                if (!valcontrol.IsValid)
                    assControl.BackColor = System.Drawing.Color.Gray;
                    assControl.BackColor = System.Drawing.Color.Violet;

in the client side code I have three Requiredfieldvalidators.I will write the code for one of them in order to give you an idea:

ControlToValidate="txtagrilevel" />

When i run the page,I get the following error pointed on the line:

 assControl.BackColor = System.Drawing.Color.Violet;
The error message is :

Object reference not set to an instance of an object.

I would appre

deploy the reports programatically in aspx page. in c#.net

zhi......... to all

i've created one ssrs report and i want to deploy in programatically.. in c#.net(.aspx page)

Textboxes get filled when page is loaded


I want to make a profile page, so the first time the page get loaded they can fill in there profile page. 
Iff they come for second time the page will load the information out of the database and put it into the textboxes.

Does anyone know how i need to put that information in textboxes...?


Page goes to error after click before page fully loaded.


Hi all ,

 When user cliick on the control before page fully loaded it goes to error page. 

Following is the trace.

Execution Error

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

  at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)

  at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)

  at System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection)

  at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)

  at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)


Master Page Error - cannot be loaded

We're using WSS 3.0
I'm not sure what's gone wrong but it all happened after authentication was set to Kerberos and then back to NTLM.
That was all sorted but now we have another problem.

The live site works fine when browsing, but when opening a page in Sharepoint Designer it says Master Page Error - The master page file '~masterurl/default.master' cannot be loaded.
If i try and attach the master page I get an error stating 'Make sure Frontpage Extensions or Sharepoint Services are installed on the server.' and there is nothing in the Details.

Sharepoint Services are installed, we have two other sites (web applications) that are working fine.

When I click on the Web Parts Taskpane in Designer it says it can only be run on servers running Windows Sharepoint Services.
Also when opening the site in Designer it asks me if I want to edit the Live Web Site or a local copy, its never done that and doesn't for the other sites.

Any idea where I've gone wrong?

Determine if page was from redirect of loaded directly


I have 2 aspx pages.

When you fill out the form and hit submit, it takes you to the secondary page. that working.

What I'm having a problem with is I have a label on the secondary page that's supposed to be visible if you get redirected form the first page. If you load the page directly, you shouldn't see the label.

What is the best way for me to find out if I was redirected or not?

ispostback I don't think is going to work cause I'm using response.redirect because of the vb on the code behind. I at one point set the postback url, but that wouldn't fire the code in the code behind.

Thanks in advance.

'Master Page cannot be loaded' Error

Hi, I suddenly started developing some near-fatal errors with my Sharepoint site. I found that it was somehow difficult to edit the home page for the site collection, so I decided to create another 'default.aspx' and replace it as the hompage. Problem is,  the new home page was still using the original master page and looked funny, so I copied and replaced the old master page, keeping it as a copy just case. When the new home page still looked funny, I deided to change everything back, but then the following error occured:

'The Master Page cannot be loaded. "File Name"
Please attach a different Master Page or go to Code View to resolve the error'.

The link to attach a different master page doesn't do anything, and the 'go to Code View' link doesn't show the error. Strangely the file name of the master page it can't load is not the default master page, and more annoyingly, the file exists!!! I don't know what to do. In Internet Explorer, the home page only shows this erroe: 'File Not Found'.

Help me, what did I do wrong?

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