473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How To avoid Flickering in my following page...?

This is my aspx page.

(Default.aspx)
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1" runat="server">
  5. <title></title>
  6. </head>
  7. <body>
  8. <form id="form2" runat="server">
  9. <div>
  10.     <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  11.     <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  12.     <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  13. <asp:dropdownlist id="drpFilterType" runat="server" AutoPostBack="True"
  14.         onselectedindexchanged="drpFilterType_SelectedIndexChanged">
  15. <asp:ListItem Value="MonthFilter">Month</asp:ListItem>
  16. <asp:ListItem Value="YearFilter">Year</asp:ListItem>
  17. <asp:ListItem Value="Other">Other</asp:ListItem>
  18.     <asp:ListItem>last</asp:ListItem>
  19. </asp:dropdownlist>
  20.     <br /><br /><br /><br />
  21. <asp:TextBox ID="TextBox1"  runat="server"></asp:TextBox>
  22.     <br /><br /><br /><br /><br />
  23. <asp:TextBox ID="TextBox2" runat="server">kaushal</asp:TextBox>
  24.     <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
  25. </div>
  26. </form>
  27. </body>
  28. </html>
And this is my C# code for the page
(Default.aspx.cs)
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. using System.Xml.Linq;
  13.  
  14. public partial class Default5 : System.Web.UI.Page
  15. {
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         TextBox1.Visible = false;
  19.     }
  20.     protected void drpFilterType_SelectedIndexChanged(object sender, EventArgs e)
  21.     {
  22.         if (drpFilterType.SelectedValue == "Other")
  23.         {
  24.             TextBox1.Visible = true;
  25.             TextBox1.Focus();
  26.         }
  27.         else
  28.         {
  29.             TextBox1.Visible = false;
  30.             TextBox2.Focus();
  31.         }
  32.     }
  33. }
When I changed selected item of DropDownList it flickers.

Please help me to find a way around this.

Thank you.
Sep 8 '11 #1
1 4699
Frinavale
9,735 Expert Mod 8TB
Replace the first <div> element (the root element) with an <asp:UpdatePanel ID="rootUpdatePanel"> </asp:UpdatePanel>.

The UpdatePanel uses Ajax which sends asynchronously posts back to the server. The browser will only update the portion of the page that is within the UpdatePanel when the request returns to the browser.

So, essentially you will be able to get rid of your flicker by placing the code that is involved with processing the request within an UpdatePanel. Hence, my suggestion of putting the entire content of your page within an UpdatePanel. But, you could change this so that only the controls that are involved with processing the DropDownList's SelectedIndexChanged event are within the UpdatePanel. Be aware that anything outside of the UpdatePanel will not be updated upon returning to the browser.

-Frinny
Sep 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Joaquin Grech | last post by:
Hi I did alot of research on this on the web and msdn and I couldn't find anything. I have a listview showing as a grid (table looking, with rows and columns and no images at all, only text)....
1
by: Manohar | last post by:
Dear All How to avoid flickering when server control is posted back? Thanx Manohar
0
by: Michael Nemtsev | last post by:
Hi, I need to stay on the current page even if user clicks "BACK" in browser. Opera is very stubborn in attemp of turning cached page off, and using current. Does anybody know the way how to say...
4
by: R.A.F. | last post by:
Hi, Basically i've read that under C++ we can avoid flickering forms during sizing (maximize, minimize, restore,...) in SDi/MDI application. I understood that for that i need to override the...
1
vinci
by: vinci | last post by:
Guys, Is it possible to remove flickering on page. This is the situation... I have a page on which i placed an event onkeydown (monitors the enter key) on which it executes a script that...
2
AllusiveKitten
by: AllusiveKitten | last post by:
Hi All Program: Microsoft Word 2003 Back ground I am trying to write a macro to insert a landscape page into a portrait document. Firstly the code must find out if there is a following...
0
by: Prasadsm | last post by:
Hi all , how to avoid flickering of tooltip? This application was done using vs-2003 and is working fine.But after converting it to vs-2008,flickering problem has arised.Please guide me in sorting...
1
by: techbytes | last post by:
hai, In my project,iam using ajax to populate dropdown values. In that ,instead of loading that dropdownvalues the entire page gets loaded in the dropdown. how to load that particular...
0
by: Billie Hartline | last post by:
I am an untrained Volunteer assisting a non-profit organization What I am attempting to do is Select the Max(ID) following an Insert into the database. Then pass the MaxID to a second page and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.