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


Top 5 Contributors of the Month
david stephan
Fauzul Azmi
Asad Ali
Post New Web Links

Simple goal but hard to execute it; Javascript or Asp.Net as best solution?

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
 

Hello all,

I've been struggling with this issue and I am sure there is a solution out there.
Basically I am trying to cache locally all the data that is sent to all TextBox(es) bound to a GridView.
Javascript would be best since that data would not be kept in the ViewState but at this point I am open to Asp.Net solution too.

Scenario:
=========
I have a Timer and a GridView which pulls the data from one SQL table every X seconds.
This table has 2 fields: id (uniqueidentifier) and comments (varchar(max)) and the data changes every rapidly.

On every page refresh the whole GridView content is replaced with whatever data is in the table.
So that gives me a few scenarios I can think of....for instance:

First request:
ID=23FF803F-3AF0-45CA-B536-096A8E410BCD; Comments="Step 1"

Second request:
ID=23FF803F-3AF0-45CA-B536-096A8E410BCD; Comments="Step 2"

Goal: I'd like to keep the previous value so that Comments="Step 1, Step 2" and so on.

Bear in mind that on a subsequent request that same ID might not exist anymore and the cached info for that ID should also be gone.

Another idea would be to have a 3rd control (i.e,Label) which would hold all the previous values. That way, the user could see the latest values in the TextBox but all the cached previous


View Complete Post


More Related Resource Links

Simple Captcha Code in Javascript

  
The article Simple Captcha Code in Javascript was added by miya2008 on Tuesday, June 29, 2010.

Here I create a Cptcha Code With JavaScriptStep 1:->In the (.aspx) page we write the following Code:->%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>!DOCTYPE

Help: Too many lines of code to achieve a simple goal: keep my NULL SQL values...

  

Hello all

Question:
--------------
What is the best way (best practice) to preserve my NULL SQL values in the database
during an insert/update operation (without receiving cast invalid errors)?
Also, how to display a string 'n/a' when a sql value is NULL?

Description:
----------------
My project is using FormView with Edit/Insert templates and classes to represent my tables

Goals:
------------
Goal1....: display 'n/a' when there are NULL SQL values in the database
Solution1: I am using ISNULL(field,'') in my store procedure for SELECT statements

Goal2....: if the fields are 'n/a', then save them back in the database as NULL
Solution2: on my insert/edit methods I am having to check the values being passed, i.e:

cmd.Parameters.Add(new SqlParameter("@scope", SqlDbType.NVarChar, 50));

if (item.Scope == "n/a")
 cmd.Parameters["@scope"].Value = DBNull.Value;
else
 cmd.Parameters["@scope"].Value = item.Scope;


Not to mention that for SQL DateType fields when you use ISNULL(field,'') the return string is '1/1/1900 12:00:00 AM'
and I have to change the field value in every field that represents a date, i.e:

protected void FormView1_DataBound(object sender, Sy

execute a javascript function in code page

  
I use js function in source page and call that js function as below in Source page<a href="javascript:;" onclick="openwin('Sample.aspx?DID=<%#Eval("UID") %>', '', '700','300','yes'); return false ">I need to call this function from vb.net code page.....how to solve this ........???????????Give ur ideas...............

Execute Javascript from Sharepoint Event Handler

  
Hello, I want to execute a sample java script function from itemadding event of sharepoint event handler.  How can i achieve this? Please Help.   Thanks in Advance

How to execute javascript function from datagrid row

  
 Hi I need to execute  a javascript function when a row of a datagrid is clicked. I am not sure how to do this. I have tried adding a template column with a button <asp:TemplateColumn>  <ItemTemplate>    <asp:Button ID="myButton" Text="Insert collection" OnClientClick="putData();" runat="server" />  </ItemTemplate></asp:TemplateColumn> And then attaching the javascript to it: myButton.Attributes.Add("onclick", "putData()") But it produces an error. Sorry this is a basic question, but what am I doing wrong?

How can i return a value from a simple WebForm.aspx to javascript code.

  

Hi Experts.

How can solve this problem; Suppose you write a simple JavaScript code in form tag like this:

<script  language="javascript">

                Var type="100";

                Var result = ';

Var iframe = '<iframe src="WebForm1.aspx?"t=' + type + '"></iframe>';

Document.write(iframe);           // call WebForm1.aspx in iframe tag

Document.write(result);            //write the result that return from WebForm1.aspx

</script>

I want return the value from WebForm1.aspx and save it in result variable. How can I do?How can i return a value from WebForm1.aspx and save it in result variable?

With Regards.Mojtaba


simple in javascript and asp.net

  

Hi

<table width="100%"  bgcolor="#99ccff" border="0px"  dir="rtl" cellspacing="2px" >
   <script type="text/javascript"  language="javascript">

       function getFile() {
           document.getElementById("file1").click();

           var file = "";

           if (document.getElementById("TextBox1").value == "")
               file = document.getElementById("file1").value;
           else
               file = document.getElementById("TextBox1").value + "\r\n" + document.getElementById("file1").value;
           document.getElementById("TextBox1").value = file;
       }

    </script>

<tr>
<td align="center">
            <asp:Label ID="lblFileName" runat="server" Font-Names="tahoma" Text="??? ????" Font-Size="small"></asp:Label>
</td>
<td>
            <asp:TextBox ID="txtFileName" runat="server" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
      <td align="center">
            <asp:Label ID="lblDesc" runat="server" Font-Names="tahoma" Font-Size="Small&q

Execute a JavaScript function from code behind

  

Hi All,

I have implemented the following progress bar;

http://mattberseth.com/blog/2007/07/google_analytics_like_ajax_pro.html

It works very well apart from i have a link on the Gridview which opens a ModalPopUp.  On the popup i have a close button which runs ModalPop.hide();  However the Progress Bar stays on the screen and I can't get rid of it??  This only happens when i have opened the Modal Popup - if i do a gridview sort the progress bar opens and hides as it should.

I have tried to execute the Java "OnUpdated" command like such but it dosent work either:

 

ClientScriptManager script = Page.ClientScript;

        if (!script.IsClientScriptBlockRegistered(this.GetType(), "Popup"))
        {

            script.RegisterClientScriptBlock(this.GetType(), "Popup", "<script type=text/javascript>onUpdated();</script>");

        }
        Panel2_ModalPopupExtender.Hide();


 

 Thanks all


Simple url rewriting with HttpHandlerFactory = hard times

  

Hi all,

 

in our website there is just one link that needs to be rewritten. The application is working on .NET 2.0. Since it's just one link i want this to be done with httphandlers. So i've added new class implementing IHttpHandlerFactory to App_Code.

 

 

    public class EventRewriter : IHttpHandlerFactory
    {
        public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
        {
            context.RewritePath("Event.aspx");
            string path = context.Server.MapPath("Event.aspx");
            return PageParser.GetCompiledPageInstance("Event.aspx", path, context);
        }

        public void ReleaseHandler(IHttpHandler handler)
        {
        }
    }

In other words - the user has ability to define his own virtual path. That path always should be rewritten to the same physical aspx file. Sounds like such a simple task to do. The user might define his path like .../xxx/yyy . I'm silently adding ".prx" extension to the link - therefore i can easily run httphandler for such extension. I've added appropiate markup to web.config so my class was used everytime someone clicks on link with such extension. And it seems to work. Everytime user clicks on link with .prx - the code execution breakpoints inside GetHandler method. The p

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.

Complete SQL Solution

  
SQL Server Solutions: SQL Server 2000/2005 Related Free Snippets.

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

Creating a Simple Class in C#

  
The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

A Simple and Extensible Radio Button Style GridView

  
The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

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