|
I hear ya. But I'm pretty sure the 'selectedindex' property of the datagrid is in the viewstate, which you are not supposed to mess with on the client manually (1st it's encrypted, 2nd ms says don't do it as they might change the format). Google selectedindex and javascript and datagrid and see what you can come up with.
|
|
|
|
|
There was an error message System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object.".
Here is my code. Is there anything wrong? I have already set the PostBackUrl button from the previous page.
<br />
if (!Page.IsPostBack)<br />
{<br />
TextBox t = (TextBox)PreviousPage.FindControl("txtStartDate");<br />
lblStartDate.Text = t.Text;<br />
}<br />
-- modified at 0:06 Monday 7th August, 2006
thanks in advance. Much appreciated.
|
|
|
|
|
I suppose you don't have txtStartDate textbox on your page, thats why this exception is raised.
Pilo
|
|
|
|
|
i have that textbox obviously.
thanks in advance. Much appreciated.
|
|
|
|
|
In this case, if you really want people to help you to solve this problem, you should copy - paste your code.
if you declare this TextBox in aspx file, then paste it here (at least relevant part), if you create it dynamicaly, paste here code where you do so.
There is a possibility, that problem is with lblStartDate.
Try to debug your application and check each value, you will see if FindControls returns your desired textBox and if lblStartDate is not null.
Pilo
|
|
|
|
|
hi,
i think you are not giving the currect textbox name or textbox is not present
check the textbox name.
thanks
|
|
|
|
|
thanks. i checked many times, but it seems i type correctly, or rather copy paste correctly.:->
thanks in advance. Much appreciated.
|
|
|
|
|
Hi,
The problem could be, the reference to the page were the textbox(txtStartDate)is available might not be referred. If the textbox has to be referred from the current page were you want the reference you can do so by.
if (!Page.IsPostBack)
{
TextBox t = (TextBox)this.Page.FindControl("txtStartDate");
lblStartDate.Text = t.Text;
}
Hope this should work
Regards
Mohan
|
|
|
|
|
I tried and I faced same error.
I should be clearer with the error. It says:
if (!Page.IsPostBack)<br />
{<br />
TextBox t = (TextBox)this.Page.FindControl("txtStartDate");<br />
lblStartDate.Text = t.Text;<br />
}
<big>lblStartDate.Text = t.Text;</big> The error stops at this line saying "Object reference not set to an instance of an object."
The troubleshooting tips were:
Use the "new" keyword to create an object instance.
Check to determine if the object is null before calling the method.
thanks in advance. Much appreciated.
|
|
|
|
|
I hope my MS visual is not haunted.
thanks in advance. Much appreciated.
|
|
|
|
|
Is that TextBox is inside any other controls like DataGrid,DataList or Panel. The reason for the Problem could be:
1) If the TextBox(txtxStartDate) is not available in the respective page.
2) If the page reference is not set when calling this.Page.FindControl
3) If the TextBox is inside some other controls like DataGrid,DataList or Panel.
Please do check and come around.
P. Mohan
|
|
|
|
|
I am using MaterPages + .NET 2.0 Login Control.
I observed that if my webform had not used the MasterPages or the webform was not autheticated by the Login Control, the postback will work fine.
Is there a diferent code?
thanks in advance. Much appreciated.
|
|
|
|
|
I have a .exe file on my disk,I want to execute it using web form.
so,how should I write the code?
thank you!
KSCsoft
|
|
|
|
|
|
Hi, good day..
i face a problem when i debug my project. I'm using asp.net 1.1 to develope the project. When i start to debug my project, an error message display. The error message show like "Cannot start debugging. Cannot find Internet Explorer". What is the main cause of this problem? Before that i run well with my project.. Anyone can help me? Thanks..
Best Regards,
Pei Sun
|
|
|
|
|
Hai
I would like to show Five day weather forecast om my website . I gone through lot of webservices which provides only US weather infoemation. I need weather report of india. Can any one get me a good webservie that satisfy my needs
|
|
|
|
|
Weather.com's XML data feed[^] provides weather information for more than 50,000 locations worldwide (including India). See this[^] example.
/ravi
|
|
|
|
|
i am trying to write the values of a dataset to a database but all the examples i am seeing shows you how you update the changes to a dataset to the database but what i am doing is that i copied out data out of one database and i want to back up it by saving it to this other database, but not really seeing any example as to how to jus write contents of the dataset to a datbase the second database has all the relvant table name and columns
kenny
|
|
|
|
|
|
I am trying to get the same functionality from MasterPages as I get when I use the html.<frames> tag.
I.e. I have 3 frames but only Number 3, which is my content frame, is refeshed the rest of the page remaned static no flickering.
switches I have used in combination:
<pages
="" smartnavigation="true" autoeventwireup="true">
I am nesting masterpages(MP) and on MP1 I have the header section and in MP2 Navigation
Problem: MP1 refreshes when MP2 refreshes. I was expecting MP1 not to refreash and MP2 content placeholder to refresh to navigation selected from MP2 sitemap
Any "help" or "directions to get help" is appreciated.
|
|
|
|
|
What you are trying to do can not be accomplished using master pages. Master pages are used to separate the contents when creating a page, but the final page that is sent to the browser has no signs of the separation. The place holders only exist on the server side. When the page is complete, there is no sign of the place holders. As the place holders don't exist at the client side, you can't update the contents of a place holder without recreating the entire page.
What you are trying to do can be accomplished using ATLAS[^], though.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your help.
|
|
|
|
|
I am still having the same flickering issue with ATLAS in place.
From the Main MasterPage
*atlas:ScriptManager ID="SM1" EnablePartialRendering="true" runat="server">
*/atlas:ScriptManager>
*atlas:UpdatePanel ID="p1" runat="server">
*ContentTemplate>
*div>
*asp:ContentPlaceHolder ID="MainPlaceHolder" runat="server">
*/asp:ContentPlaceHolder>
*/div>
*/ContentTemplate>
*/atlas:UpdatePanel>
With the above code one would think that when the Parent would not refresh when the child does.
-- modified at 17:01 Monday 7th August, 2006
|
|
|
|
|
A postback will still update the entire page. You have to do the update using ATLAS.
---
b { font-weight: normal; }
|
|
|
|
|
All,
i am creating a gateway application that speaks SOAP out of one side and a proprietary network protocol out of the other. i would like to use SOAP extensions to 'trampoline' the incoming SOAP message into the proprietary network format and send it on to the appropriate stream.
i have set up a little test of the SOAP extension framework by copying and modifying the trace extension sample from the .net framework library. However, i cannot get even this sample to execute the code associated with the extension.
Below are the relevant snippets of code. Any help would be greatly appreciated.
FYI, i have tried several variations of the setup below, including
1. with and without the remove HTTP[GET,POST] in the protocols section of the webservices element -- per the Developmentor sample;
2. posting the request in different ways
a. from the asp page generated by asp.net from the wsdl
b. using a little jscript tool for posting cribbed from the Developmentor sample
Note also that everything is packaged up in a single assembly, APP_Code.dll, and this seems to match the expectations asp.net has regarding the web.config.
Best wishes,
--greg
//SOAP extension code
namespace AVSOAPIntercept {
...
public class AVTraceExtension : SoapExtension
{
Stream oldStream;
Stream newStream;
string filename;
// Save the Stream representing the SOAP request or SOAP response into
// a local memory buffer.
public override Stream ChainStream( Stream stream )
{
oldStream = stream;
newStream = new MemoryStream();
return newStream;
}
// When the SOAP extension is accessed for the first time, the XML Web
// service method it is applied to is accessed to store the file
// name passed in, using the corresponding SoapExtensionAttribute.
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
{
return ((AVTraceExtensionAttribute) attribute).Filename;
}
// The SOAP extension was configured to run using a configuration file
// instead of an attribute applied to a specific XML Web service
// method.
public override object GetInitializer(Type WebServiceType)
{
// Return a file name to log the trace information to, based on the
// type.
return "C:\\" + WebServiceType.FullName + ".log";
}
// Receive the file name stored by GetInitializer and store it in a
// member variable for this specific instance.
public override void Initialize(object initializer)
{
filename = (string) initializer;
}
// If the SoapMessageStage is such that the SoapRequest or
// SoapResponse is still in the SOAP format to be sent or received,
// save it out to a file.
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
case SoapMessageStage.BeforeSerialize:
break;
case SoapMessageStage.AfterSerialize:
WriteOutput(message);
break;
case SoapMessageStage.BeforeDeserialize:
WriteInput(message);
break;
case SoapMessageStage.AfterDeserialize:
break;
default:
throw new Exception("invalid stage");
}
}
public void WriteOutput(SoapMessage message)
{
newStream.Position = 0;
FileStream fs = new FileStream(filename, FileMode.Append,
FileAccess.Write);
StreamWriter w = new StreamWriter(fs);
string soapString = (message is SoapServerMessage) ? "SoapResponse" : "SoapRequest";
w.WriteLine("-----" + soapString + " at " + DateTime.Now);
w.WriteLine("The method that has been invoked is: ");
w.WriteLine("\t" + message.MethodInfo);
w.Flush();
Copy(newStream, fs);
w.Close();
newStream.Position = 0;
Copy(newStream, oldStream);
}
public void WriteInput(SoapMessage message)
{
Copy(oldStream, newStream);
FileStream fs = new FileStream(filename, FileMode.Append,
FileAccess.Write);
StreamWriter w = new StreamWriter(fs);
string soapString = (message is SoapServerMessage) ?
"SoapRequest" : "SoapResponse";
w.WriteLine("-----" + soapString +
" at " + DateTime.Now);
w.WriteLine("The method that has been invoked is: ");
w.WriteLine("\t" + message.MethodInfo);
w.Flush();
newStream.Position = 0;
Copy(newStream, fs);
w.Close();
newStream.Position = 0;
}
void Copy(Stream from, Stream to)
{
TextReader reader = new StreamReader(from);
TextWriter writer = new StreamWriter(to);
writer.WriteLine(reader.ReadToEnd());
writer.Flush();
}
}
// Create a SoapExtensionAttribute for the SOAP Extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets.Method)]
public class AVTraceExtensionAttribute : SoapExtensionAttribute
{
private string filename = "c:\\log.txt";
private int priority;
public override Type ExtensionType
{
get { return typeof(AVTraceExtension); }
}
public override int Priority
{
get { return priority; }
set { priority = value; }
}
public string Filename
{
get
{
return filename;
}
set
{
filename = value;
}
}
}
...
}
// Method decoration
[AVTraceExtension]
[WebMethod(EnableSession=true)]
public void AV_LOGIN(string loginName, string application, string appVersionStr, string SysInfo) {
// Code that ought to be in the trampoline
}
}
<configuration>
<appsettings>
<connectionstrings>
<system.web>
<trace enabled="true"> <compilation debug="true">
<authentication mode="Windows">
<webservices>
<protocols>
<remove name="HttpPost">
<remove name="HttpGet">
<soapextensiontypes>
<add type="AVSOAPIntercept.AVTraceExtension,
App_Code"
="" priority="1" group="Low">
|
|
|
|