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.
If I don't set it, and let a button click do the postback, the event
fires normally.
*note: using visual studio 2005 + dotnet 2.0
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="contentTabl e" >
<asp:TableRow >
<asp:TableCel l VerticalAlign=" Top">
<asp:TreeView runat=server ID="reportListi ng"
OnSelectedNodeC hanged="reportL isting_Selected NodeChanged">
</asp:TreeView>
</asp:TableCell>
<asp:TableCel l VerticalAlign=" Top">
<asp:GridView runat=server ID="reportDetai ls">
</asp:GridView>
</asp:TableCell>
<asp:TableCel l VerticalAlign=" Top">
<asp:DropDownLi st runat="server"
ID="frequencyLi stDropDown" AutoPostBack="t rue"
OnSelectedIndex Changed="freque ncyListDropDown _SelectedIndexC hanged">
<asp:ListItem
Selected=True>D aily</asp:ListItem>
<asp:ListItem>W eekly</asp:ListItem>
<asp:ListItem>M iddle And End Of
Month</asp:ListItem>
<asp:ListItem>M onthly</asp:ListItem>
</asp:DropDownlis t>
</asp:TableCell>
<asp:TableCel l VerticalAlign=" Top">
<asp:CheckBoxLi st runat=server ID="daysOfWeek "
RepeatDirection ="Horizontal " Visible=false>
<asp:ListItem>S unday</asp:ListItem>
<asp:ListItem>M onday</asp:ListItem>
<asp:ListItem>T uesday</asp:ListItem>
<asp:ListItem>W ednesday</asp:ListItem>
<asp:ListItem>T hursday</asp:ListItem>
<asp:ListItem>F riday</asp:ListItem>
<asp:ListItem>S aturday</asp:ListItem>
</asp:CheckBoxLis t>
<asp:Calendar runat=server ID="monthDaySel ect"
Visible=false></asp:Calendar>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow >
<asp:TableCell> </asp:TableCell>
<asp:TableCell> </asp:TableCell>
<asp:TableCel l>
<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.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack) //set up initial page
{
System.Data.Dat aSet reportList = new DataSet();
reportList.Read Xml(Server.MapP ath("Reports.xm l"));
foreach (DataTable t in reportList.Tabl es)
{
foreach (DataRow dr in t.Rows)
{
TreeNode parentNode = new TreeNode();
parentNode.Text = dr.Table.TableN ame;
reportListing.N odes.Add(parent Node);
foreach (string innerRow in dr.ItemArray)
{
parentNode.Chil dNodes.Add(new
TreeNode(innerR ow));
}
}
}
}
}
protected void frequencyListDr opDown_Selected IndexChanged(ob ject
sender, EventArgs e)
{
//if (IsPostBack)
{
if (frequencyListD ropDown.Selecte dValue == "Monthly")
{
daysOfWeek.Visi ble = false;
monthDaySelect. Visible = true;
}
else if (frequencyListD ropDown.Selecte dValue == "Weekly")
{
daysOfWeek.Visi ble = true;
monthDaySelect. Visible = false;
}
else if ((frequencyList DropDown.Select edValue == "Daily")
|| (frequencyListD ropDown.Selecte dValue == "Middle And End Of Month"))
{
daysOfWeek.Visi ble = false;
monthDaySelect. Visible = false;
}
}
}
protected void submit_click(ob ject sender, EventArgs e)
{
}
protected void reportListing_S electedNodeChan ged(object sender,
EventArgs e)
{
}