473,378 Members | 1,500 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,378 software developers and data experts.

problems with AutoPostBack

I've got a simple page I've made with a few controls (Treeview,
Dropdownlist, ..). I'm running into an issue with autopostback. If I
set it to AutoPostBack = "True", when the event should fire I get a
Javascript error in IE.

*Note: this is using Visual Studio 2005 std. and .NET 2.0*

If I don't set it, and let a button click do the postback, the event
fires normally.

Any help would be greatly appreciated.

IE Error:
Line: 34
Char: 9
Error: Object doesn't support this property or method.
Code: 0
URL: http://localhost:4022/ReportSchedule...geReports.aspx

markup:
<form id="form1" runat="server">
<asp:Table runat=server ID="contentTable" >
<asp:TableRow>
<asp:TableCell VerticalAlign="Top">
<asp:TreeView runat=server ID="reportListing"
OnSelectedNodeChanged="reportListing_SelectedNodeC hanged">
</asp:TreeView>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:GridView runat=server ID="reportDetails">

</asp:GridView>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:DropDownList runat="server"
ID="frequencyListDropDown" AutoPostBack="true"
OnSelectedIndexChanged="frequencyListDropDown_Sele ctedIndexChanged">
<asp:ListItem
Selected=True>Daily</asp:ListItem>
<asp:ListItem>Weekly</asp:ListItem>
<asp:ListItem>Middle And End Of
Month</asp:ListItem>
<asp:ListItem>Monthly</asp:ListItem>
</asp:DropDownlist>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:CheckBoxList runat=server ID="daysOfWeek"
RepeatDirection="Horizontal" Visible=false>
<asp:ListItem>Sunday</asp:ListItem>
<asp:ListItem>Monday</asp:ListItem>
<asp:ListItem>Tuesday</asp:ListItem>
<asp:ListItem>Wednesday</asp:ListItem>
<asp:ListItem>Thursday</asp:ListItem>
<asp:ListItem>Friday</asp:ListItem>
<asp:ListItem>Saturday</asp:ListItem>
</asp:CheckBoxList>
<asp:Calendar runat=server ID="monthDaySelect"
Visible=false></asp:Calendar>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell></asp:TableCell>
<asp:TableCell></asp:TableCell>
<asp:TableCell>
<asp:Button runat=server ID="submit"
OnClick="submit_click" Text="Submit" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>

Codebehind:

public partial class ManageReports : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack) //set up initial page
{

System.Data.DataSet reportList = new DataSet();
reportList.ReadXml(Server.MapPath("Reports.xml"));
foreach (DataTable t in reportList.Tables)
{
foreach (DataRow dr in t.Rows)
{
TreeNode parentNode = new TreeNode();
parentNode.Text = dr.Table.TableName;
reportListing.Nodes.Add(parentNode);
foreach (string innerRow in dr.ItemArray)
{
parentNode.ChildNodes.Add(new
TreeNode(innerRow));
}
}
}
}
}

protected void frequencyListDropDown_SelectedIndexChanged(object
sender, EventArgs e)
{
//if (IsPostBack)
{
if (frequencyListDropDown.SelectedValue == "Monthly")
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = true;

}
else if (frequencyListDropDown.SelectedValue == "Weekly")
{
daysOfWeek.Visible = true;
monthDaySelect.Visible = false;
}
else if ((frequencyListDropDown.SelectedValue == "Daily")
|| (frequencyListDropDown.SelectedValue == "Middle And End Of Month"))
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = false;
}
}
}

protected void submit_click(object sender, EventArgs e)
{

}

protected void reportListing_SelectedNodeChanged(object sender,
EventArgs e)
{

}

Jan 20 '06 #1
2 2101
Sean,

Can you post the full ASPX and CS files?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sean Chapman" <se**********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I've got a simple page I've made with a few controls (Treeview,
Dropdownlist, ..). I'm running into an issue with autopostback. If I
set it to AutoPostBack = "True", when the event should fire I get a
Javascript error in IE.

*Note: this is using Visual Studio 2005 std. and .NET 2.0*

If I don't set it, and let a button click do the postback, the event
fires normally.

Any help would be greatly appreciated.

IE Error:
Line: 34
Char: 9
Error: Object doesn't support this property or method.
Code: 0
URL: http://localhost:4022/ReportSchedule...geReports.aspx

markup:
<form id="form1" runat="server">
<asp:Table runat=server ID="contentTable" >
<asp:TableRow>
<asp:TableCell VerticalAlign="Top">
<asp:TreeView runat=server ID="reportListing"
OnSelectedNodeChanged="reportListing_SelectedNodeC hanged">
</asp:TreeView>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:GridView runat=server ID="reportDetails">

</asp:GridView>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:DropDownList runat="server"
ID="frequencyListDropDown" AutoPostBack="true"
OnSelectedIndexChanged="frequencyListDropDown_Sele ctedIndexChanged">
<asp:ListItem
Selected=True>Daily</asp:ListItem>
<asp:ListItem>Weekly</asp:ListItem>
<asp:ListItem>Middle And End Of
Month</asp:ListItem>
<asp:ListItem>Monthly</asp:ListItem>
</asp:DropDownlist>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:CheckBoxList runat=server ID="daysOfWeek"
RepeatDirection="Horizontal" Visible=false>
<asp:ListItem>Sunday</asp:ListItem>
<asp:ListItem>Monday</asp:ListItem>
<asp:ListItem>Tuesday</asp:ListItem>
<asp:ListItem>Wednesday</asp:ListItem>
<asp:ListItem>Thursday</asp:ListItem>
<asp:ListItem>Friday</asp:ListItem>
<asp:ListItem>Saturday</asp:ListItem>
</asp:CheckBoxList>
<asp:Calendar runat=server ID="monthDaySelect"
Visible=false></asp:Calendar>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell></asp:TableCell>
<asp:TableCell></asp:TableCell>
<asp:TableCell>
<asp:Button runat=server ID="submit"
OnClick="submit_click" Text="Submit" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>

Codebehind:

public partial class ManageReports : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack) //set up initial page
{

System.Data.DataSet reportList = new DataSet();
reportList.ReadXml(Server.MapPath("Reports.xml"));
foreach (DataTable t in reportList.Tables)
{
foreach (DataRow dr in t.Rows)
{
TreeNode parentNode = new TreeNode();
parentNode.Text = dr.Table.TableName;
reportListing.Nodes.Add(parentNode);
foreach (string innerRow in dr.ItemArray)
{
parentNode.ChildNodes.Add(new
TreeNode(innerRow));
}
}
}
}
}

protected void frequencyListDropDown_SelectedIndexChanged(object
sender, EventArgs e)
{
//if (IsPostBack)
{
if (frequencyListDropDown.SelectedValue == "Monthly")
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = true;

}
else if (frequencyListDropDown.SelectedValue == "Weekly")
{
daysOfWeek.Visible = true;
monthDaySelect.Visible = false;
}
else if ((frequencyListDropDown.SelectedValue == "Daily")
|| (frequencyListDropDown.SelectedValue == "Middle And End Of Month"))
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = false;
}
}
}

protected void submit_click(object sender, EventArgs e)
{

}

protected void reportListing_SelectedNodeChanged(object sender,
EventArgs e)
{

}

Jan 21 '06 #2
That was most of it.. but here's the full copy/past for the markup/code
behind:
MARKUP:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="ManageReports.aspx.cs" Inherits="ManageReports" %>

<!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>Manage Report Schedule</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Table runat=server ID="contentTable" >
<asp:TableRow>
<asp:TableCell>
<asp:Label runat="server"
ID="userLabel"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell VerticalAlign="Top">
<asp:TreeView runat=server ID="reportListing"
OnSelectedNodeChanged="reportListing_SelectedNodeC hanged">
</asp:TreeView>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">

</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:DropDownList runat="server"
ID="frequencyListDropDown" AutoPostBack="true"
OnSelectedIndexChanged="frequencyListDropDown_Sele ctedIndexChanged">
<asp:ListItem
Selected=True>Daily</asp:ListItem>
<asp:ListItem>Weekly</asp:ListItem>
<asp:ListItem>Middle And End Of
Month</asp:ListItem>
<asp:ListItem>Monthly</asp:ListItem>
</asp:DropDownlist>
</asp:TableCell>
<asp:TableCell VerticalAlign="Top">
<asp:CheckBoxList runat=server ID="daysOfWeek"
RepeatDirection="Horizontal" Visible=false>
<asp:ListItem>Sunday</asp:ListItem>
<asp:ListItem>Monday</asp:ListItem>
<asp:ListItem>Tuesday</asp:ListItem>
<asp:ListItem>Wednesday</asp:ListItem>
<asp:ListItem>Thursday</asp:ListItem>
<asp:ListItem>Friday</asp:ListItem>
<asp:ListItem>Saturday</asp:ListItem>
</asp:CheckBoxList>
<asp:Calendar runat=server ID="monthDaySelect"
Visible=false></asp:Calendar>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell></asp:TableCell>
<asp:TableCell></asp:TableCell>
<asp:TableCell>
<asp:Button runat=server ID="submit"
OnClick="submit_click" Text="Submit" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>

CODEBEHIND:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using System.Xml;

public partial class ManageReports : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) //set up initial page
{
System.Data.DataSet reportList = new DataSet();
reportList.ReadXml(Server.MapPath("Reports.xml"));
userLabel.Text = (string)Session["user"];
foreach (DataTable t in reportList.Tables)
{
foreach (DataRow dr in t.Rows)
{
TreeNode parentNode = new TreeNode();
parentNode.Text = dr.Table.TableName;
reportListing.Nodes.Add(parentNode);
foreach (string innerRow in dr.ItemArray)
{
parentNode.ChildNodes.Add(new
TreeNode(innerRow));
}
}
}
}
}

protected void frequencyListDropDown_SelectedIndexChanged(object
sender, EventArgs e)
{
//if (IsPostBack)
{
if (frequencyListDropDown.SelectedValue == "Monthly")
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = true;

}
else if (frequencyListDropDown.SelectedValue == "Weekly")
{
daysOfWeek.Visible = true;
monthDaySelect.Visible = false;
}
else if ((frequencyListDropDown.SelectedValue == "Daily")
|| (frequencyListDropDown.SelectedValue == "Middle And End Of Month"))
{
daysOfWeek.Visible = false;
monthDaySelect.Visible = false;
}
}
}

protected void submit_click(object sender, EventArgs e)
{

}

protected void reportListing_SelectedNodeChanged(object sender,
EventArgs e)
{

}
}

thanks for any input.

Jan 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their...
8
by: Matthew Louden | last post by:
why need to set autopostback property to be true?? I know autopostback event means to send the form to the server automatically. I tried checkbox, checkbox list, radio button, and radio button...
3
by: TCORDON | last post by:
I have two different web pages...one has 2 textboxes (Username and Pwd) and an Image button, in this webpage if the user enters his username and pwd and hits enter, the ImageButton's click event is...
6
by: tfsmag | last post by:
I have a Grid that I've set up to have two of the fields use dropdownlists while in edit mode. Now I can bind the data to the dropdownlists just fine. My problem is that the second dropdown depends...
2
by: tshad | last post by:
I have a page that has been displaying some weird behavior. I have 2 radio buttons that work fine until I press the link button with an item selected in my link box (if an item is not selected,...
0
by: riley.derrick | last post by:
To all the ASP.NET 2.0 Gurus, I am having a bit of a problem. Here is the situation. I have a created a web form that does the following. Has 2 dropdown lists that are databound to a SQL...
2
by: rn5a | last post by:
Assume that a user control has a TextBox (Page1.ascx) <asp:TextBox ID="txtName" runat="server"/> I am encapsulating the above user control in a ASPX page named Page1.aspx i.e. the ASPX page...
0
by: Mark Sandfox | last post by:
Below is basically the code direct from "SAMS ASP.NET unleashed". Without the AutoPostBack="True" i get dump to a page cannot be displayed witht "javascript:__doPostBack('calCalendar','V2588')" in...
6
by: Peter | last post by:
ASP.NET 2.0 Visual Studio 2008 I have the following code and when the textbox displays and I press Enter while in the text box I get AutoPostBack, how do I stop AutoPostBack? TextBox txt =...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.