Click here to Skip to main content
15,889,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:16
Dayekh1-Apr-10 5:16 
GeneralRe: Detect an external email address Pin
JHizzle1-Apr-10 5:24
JHizzle1-Apr-10 5:24 
GeneralRe: Detect an external email address Pin
Dayekh1-Apr-10 5:54
Dayekh1-Apr-10 5:54 
Questioncross platform feature of asp.net Pin
ships_agr1-Apr-10 3:43
ships_agr1-Apr-10 3:43 
AnswerRe: cross platform feature of asp.net Pin
JHizzle1-Apr-10 4:04
JHizzle1-Apr-10 4:04 
AnswerRe: cross platform feature of asp.net Pin
MyDevBank1-Apr-10 4:35
MyDevBank1-Apr-10 4:35 
AnswerRe: cross platform feature of asp.net Pin
T M Gray1-Apr-10 5:41
T M Gray1-Apr-10 5:41 
QuestionProblem regarding Icallback & Viewstate Pin
Tridip Bhattacharjee1-Apr-10 3:03
professionalTridip Bhattacharjee1-Apr-10 3:03 
when partial postback is happen then accessing data from viewstate is getting problem. it is giving error like
"threw an exception of type 'System.NullReferenceException".

here i giving a small sample code by which anyone can undersdtand what i am trying to do

ASPX Page
-----------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/ecmascript">
function ReceiveServerData(rValue)
{
document.getElementById("ResultsSpan").innerHTML = rValue;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID=btn1 runat=server Text="Button1" OnClientClick="CallServer('btn1', '');" />
<asp:Button ID=btn2 runat=server Text="Button2" OnClientClick="CallServer('btn2', '');"/>
<div id="ResultsSpan"></div>
</div>
</form>
</body>
</html>

Code Page
-----------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page ,ICallbackEventHandler
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsCallback)
{
String cbReference =
Page.ClientScript.GetCallbackEventReference(this,"arg", "ReceiveServerData", "context");

String callbackScript;
callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"CallServer", callbackScript, true);
}
}

public void RaiseCallbackEvent(String eventArgument)
{
//threw an exception of type 'System.NullReferenceException
if (vwValue == "")
{
vwValue = "Hello";
}
}

public String GetCallbackResult()
{
return vwValue;
}

public string vwValue
{
get
{
if (ViewState["dt"] != null)
return ViewState["dt"].ToString();
else
return "";
}
set
{
ViewState["dt"] = value;
}
}

}

first time i assing value to viewstate when callback happen and when again callback happen then i am not getting anyvalue in viewstate which
i have stored in first call back. i just can not understand why it is happening. please help me to understand the problem and also show me the
way i can persist value in viewstate accross multile callback. please help me with a small sample code.

thanks in advance.
tbhattacharjee

AnswerRe: Problem regarding Icallback & Viewstate Pin
Not Active1-Apr-10 3:38
mentorNot Active1-Apr-10 3:38 
QuestionReg IIS Pin
sowjanya331-Mar-10 23:41
sowjanya331-Mar-10 23:41 
AnswerRe: Reg IIS [modified] Pin
JHizzle31-Mar-10 23:51
JHizzle31-Mar-10 23:51 
GeneralRe: Reg IIS Pin
sowjanya34-Apr-10 22:01
sowjanya34-Apr-10 22:01 
AnswerRe: Reg IIS Pin
Abhijit Jana1-Apr-10 0:27
professionalAbhijit Jana1-Apr-10 0:27 
GeneralRe: Reg IIS Pin
Venkatesh Mookkan1-Apr-10 0:44
Venkatesh Mookkan1-Apr-10 0:44 
GeneralRe: Reg IIS Pin
Abhijit Jana1-Apr-10 1:01
professionalAbhijit Jana1-Apr-10 1:01 
GeneralRe: Reg IIS Pin
Venkatesh Mookkan1-Apr-10 1:15
Venkatesh Mookkan1-Apr-10 1:15 
QuestionData Validation Controls not working in Windows 7 machine Pin
Robymon31-Mar-10 23:10
Robymon31-Mar-10 23:10 
AnswerRe: Data Validation Controls not working in Windows 7 machine Pin
JHizzle31-Mar-10 23:37
JHizzle31-Mar-10 23:37 
GeneralRe: Data Validation Controls not working in Windows 7 machine Pin
Robymon1-Apr-10 0:16
Robymon1-Apr-10 0:16 
QuestionItem command not firing repeater control pop up extender Pin
rahul_miche31-Mar-10 22:53
rahul_miche31-Mar-10 22:53 
AnswerRe: Item command not firing repeater control pop up extender Pin
michaelschmitt1-Apr-10 6:46
michaelschmitt1-Apr-10 6:46 
AnswerRe: Item command not firing repeater control pop up extender Pin
T M Gray1-Apr-10 7:47
T M Gray1-Apr-10 7:47 
Questionsave page state after post back Pin
Abdul Rahman Hamidy31-Mar-10 22:38
Abdul Rahman Hamidy31-Mar-10 22:38 
AnswerRe: save page state after post back Pin
R. Giskard Reventlov31-Mar-10 23:21
R. Giskard Reventlov31-Mar-10 23:21 
AnswerRe: save page state after post back Pin
Venkatesh Mookkan1-Apr-10 0:54
Venkatesh Mookkan1-Apr-10 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.