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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

A Question about using Javascript with Web Forms

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net
 

I am just learning to use Javascript and web forms.  I have a few questions that I hope to get answers to:

 

  1. Am I correct that when doing things like hiding controls or hiding HTML elements on a page that I should use Javascript to do so as opposed to setting the Visible property on the control?
  2. If I set a control or element to hidden using Javascript should I also set the Visible on the webform control as well so that the value on the webform control is in synch with the value set in Javascript?
  3. Are there any guidelines as to when to set something in my C# code on a control as oppossed to when I should use Javascript to do the same thing?

Thanks




View Complete Post


More Related Resource Links

A question with ASP.NET Web Forms

  
Hello friend...I 'm @C Sharp Coder ;  I have a problem.It is with ASP.NET Web Forms.I want transfer other aspx page to my aspx page with include but I don't look a include function like Response.Include("pageName.aspx"): I want dynamic include :)Thanks for all replies :)C Sharp CoderWPF/Silverlight Software Developer

Replacing a text question in a Survey using JavaScript at runtime (document.body.innerHTML.replace)

  
Hi, I want to replace some of the text in a SharePoint Survey at runtime.  The idea behind that is to add a "header" or "title" to questions that are related together.  For example, let's say I have 2 related questions, a page separator, and 2 more related questions: (yes/no type of questions): Q1.  Are you between 20 and 40? Q2.  Did you went to college?   --page separator-- Q3.  J2EE Q4.  C/C++ The result on the final Survey should look like this: Tell us about you. Are you between 20 and 40?  Did you went to college?   --page separator-- Indicate what programming languages you know: J2EE C/C++ Simply, I tried to use the document.body.innerHTML.replace() in order to replace:  - Q1 with: <h2>Tell us about you.</h2>  - Q2 with ''  - Q3 with: <h2>Indicate what programming languages you know:</h2>  - Q4 with: '' Using the technique below, I added the following code in SharePoint Designer in NewForm.aspx: <asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server"> <script id="onetidPageTitleAreaFrameScript"> document.getElementById("onetidPageTitleAreaFrame").className="ms-areaseparator"; document.body.innerHTML = document.body.innerHTML.replace(/Q1/g,'

Windows forms important question

  
Hi, I have a windows forms application with a number of forms. I have added a new form to it and now i want this form to appear first at runtime. Actually the new form that i added is a mainn menu form so that is why i wanted it to appear first at runtime. Please tell me how can i make this main menu form to appear first at runtime. Thank you, Syed

Basic Web Forms Question Regarding Returning Html To The page

  

I have a web application I am working on but this is using simple web forms.

Long story short I want to create a commenting system similar to that of google sites for example.

All comments are saved to the database against a user id and submission id (meaning they are relevant to the page they are presented on).

Currently I am displaying them in a table using GridView which is kinda well annoying.

Is there anyway to return custom HTML from the server to a palceholder control or something of the like.

Basically run a for loop and fill up a placeholder control with html that will render appropriatelly

I know, its basic but I am a total noob.


AutoCompleteExtender +JavaScript onchange Question

  

i have textbox and autocompleteextender fills list for this textbox

 

onchange for this textbox calls javascript function

 

if i click on the scroll of the list autocompleteextender populate the javascript function fires. how can i disable this ????

 


html/javascript (jQuery)/ajax patterns question

  

My presentation layer (UI) will consist of pure html (no webforms) javascript, jquery making calls to (Ajax enabled) WCF services. can I use MVC (in my presentation layer) in this context or not?

thanks.


Profiling Question for Widnows Forms Application

  

Hi,

I am profiling a windows forms application using ANTS profiler.

One of the forms has got many user controls and it takes time to create these user controls.

The pro filer shows the following line taking around 700ms for the first control.

        private System.ComponentModel.IContainer components = null;

The subsequent ones takes lesser time for executing this line, but still the last one take 200 ms.

This is affecting my start up time.

Is there any workqroung to make it faster?

 

Thanks!


JavaScript, passing reference to a form element question

  

I have a simple audio player that is controlled with JavaScript initiated by ASP.NET imagebuttons. When the user clicks on the "play" button the image is switched out for a different button image to make it "light up" while playing; when the player is finished the original image is put back so the button appears dark again. Originally, I was doing this by hardcoding in the client element ids for the image buttons ("ctl00_Middle_Voice1_LoginView1_StartLoad"), but that restricted where I could use the control. So, I have switched it so that in the ImageButton OnClientClick function I pass in 'this' and then refer to that control in the function to change the image source.

This works fine for the initial function called by OnClientClick (Play), but that function in turn calls a second function to determine the timing, control the progress bar, and whether or not the player is done playing yet and if so to swap back the original image. In that second function (Timing), I get a null object reference if I try to pass the element in again as an argument.

I have tried getting the id of the element and passing that instead (and then locating the element from the second function with getElementByID), but get the same error.

<eo:ProgressBar ID="ProgressBar1" runat="server" BorderColor="Black" BorderWidth="1px" IndicatorColor="Red" Hei

Windows Forms Databinding question

  

  I have a custom control (extended TextBox) that I added Ghost text functionality to.

Essentially if the text value is empty, the textbox displays the ghost message in a light gray color in the textbox.
If the 
ghost message is displayed and the user sets focus to the TextBox, the Text value is then reset to empty string.

My problem comes into play when databinding the textbox Text field. If the user clears the text form the TextBox then the value that is updated to the binding source is the ghost message. I don't want that, I am wondering if there is a way to interrupt the binding source update value, and inject an empty string instead of the ghost message.

I hope I explained it effectively, any help would be appreciated.


ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

  
This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Routing for Web Forms in ASP.NET 4.0

  
posted a prototype demonstrating how one could use Routing within Web Forms. This is something you can do today with ASP.NET 3.5 SP1, because of the work we did to separate Routing from ASP.NET MVC. I would have liked to include Web Form Routing as part of the Routing feature when we were working on SP1, but we didn't have the time to do so in a robust manner before SP1 was locked down.

Application Architecture in Windows Forms 2.0

  
Applications have special support in Windows Forms. For starters, you can manage and tailor your application's lifetime, and, when the work flow is disrupted by an unhandled exception, you can choose from several methods of response. Then, there are several application models that you can employ, including Single Document Interface (SDI) and Multiple Document Interface (MDI) applications, each of which can support either multiple-instance or single-instance mode, the former the VS05 default and the latter requiring special consideration. All applications, however, can discover and use a wide variety of information about the system and environment they execute in.

Application Architecture in Windows Forms 2.0-Single-MDI Applications

  
Consider an MDI application like Microsoft Excel; files opened from the file system (by double-clicking) are all opened as separate child windows within the parent Excel window.7 For the first instance of an MDI application to open a new child window to display the file that was passed to the second instance of the application, the second instance must be able to communicate with the initial instance.

Ajax Enabled Gridview using JavaScript in ASP.NET

  
Before explaining the article, I would like to thank all readers who read my article and voted for it. Your appreciation for my article gives me strength to write more good articles. Hope in future I will get your valuable comments and suggestions. Now I won't waste your time and come back to the topic. I have written this article on 'Ajax Enabled Gridview Using JavaScript in ASP.NET'. In this article, I will show you how to make a Gridview using a simple HTML table, JavaScript and XML HTTP for Ajax call without using any ASP.NET control.

Using Code

GridView Javascript Click Row and Ajax

  
This article shows 2 common tasks with the ASP.NET GridView: Binding a List (generic) of objects as DataSource and on clicking a row, getting the values of the selected row by a javascript function. In the example a List with User-objects is displayed. On clicking a row containing the data of a User-object, the Id of the object is used to get the address of the user by an Ajax-call and display it in a details-field.
Categories: 
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