Unable to resolve ASP.NET error when starting web app - asp.net

Here is my code:
<ajaxToolKit:TabPanel ID="mainTabMedicaidData" runat="server" HeaderText="Medicaid Data">
<ContentTemplate>
<ajaxToolKit:TabContainer ID="MedicaidDataSubTabContainer" runat="server">
<ajaxToolKit:TabPanel ID="TabPanel1" runat="server" HeaderText="Search">
<ContentTemplate>
<asp:UpdatePanel ID="MedicaidDataPanel" runat="server" UpdateMode="Always">
<ContentTemplate>
<div class="formRow">
<asp:Label runat="server" ID="uxMedicaidData_StudentNumberLabel" AssociatedControlID="uxMedicaidData_StudentNumber">
Student ID:
</asp:Label>
<asp:TextBox runat="server" ID="uxMedicaidData_StudentNumber" MaxLength="30" Width="80px"></asp:TextBox>
<asp:Label runat="server" ID="uxMedicaidData_SchoolYearLabel" AssociatedControlID="uxMedicaidData_SchoolYear">
School Year:
</asp:Label>
<asp:TextBox runat="server" ID="uxMedicaidData_SchoolYear" MaxLength="30" Width="50px"></asp:TextBox>
<asp:Label runat="server" ID="uxMedicaidData_CategoryLabel" AssociatedControlID="uxMedicaidData_ddCategory">
Category:
</asp:Label>
<asp:DropDownList ID="uxMedicaidData_ddCategory" runat="server"></asp:DropDownList>
<asp:Button runat="server" ID="MedicaidData_Search" Text="Search" width="100px" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
I know that the snippet does not have a closing tag for some of the tags at the beginning of the snippet. The reason I left them out is because there is a lot of code between them and their closing tags. Besides, from what I can tell my problem is with the with either 1 line or another in this code snippet.
When I try to compile this to run the web app I get the following error:
TabContainer cannot have children of type
'System.Web.UI.WebControls.Button'.
The error highlights this line:
<ajaxToolKit:TabContainer ID="MedicaidDataSubTabContainer" runat="server">
But because the error states there can't be a button in the container I'm wondering if this line has something to do with it:
<asp:Button runat="server" ID="MedicaidData_Search" Text="Search" width="100px" />
I've looked at quite a few solutions online and they all say that the container needs runat="server" and an ID. As you can see both of these lines have those parts. Anyone have an idea of another solution I can try? Thanks in advance.

I think it's because you have content outside of a content template.
The outline should be
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
<ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
<ContentTemplate>
Content1
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
<ContentTemplate>
Content2
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>

Related

Partially Upload Listview data using UpdatePanel in Asp.net

I want to partially update data of this listview.
<asp:ListView ID="ListView_SoldItems" runat="server" OnItemDataBound="ListView_SoldItems_ItemDataBound" >
<ItemTemplate>
<uc1:SongUC runat="server" id="SongUC" />
</ItemTemplate>
</asp:ListView>
If it wasn't a listview I could have done this.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
<ContentTemplate>
<asp:ListView ID="ListView_SoldItems" runat="server" OnItemDataBound="ListView_SoldItems_ItemDataBound" >
<ItemTemplate>
<uc1:SongUC runat="server" id="SongUC" />
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
So what would be the solution for this?
I found it.
<asp:ListView ID="ListView_SoldItems" runat="server" OnItemDataBound="ListView_SoldItems_ItemDataBound" ClientIDMode="AutoID" >
Just had to add the ClientIDMode="AutoID" property to the Listview.

'System.Web.UI.WebControls.ImageButton' does not have a public property named 'UpdateProgress'

In a page I have a grid and 2 drop down lists inside a update panel. From drop down list user will select and selected item will saved and shown in update panel. I am also planning to use updateprogress with it.
On doing this I am getting this design time error " 'System.Web.UI.WebControls.ImageButton' does not have a public property named 'UpdateProgress'"
I have spent a lot of time on it but couldn't solve it. Please help me. Here is my code for this.
<tr>
<td colspan="3">
<div>
<asp:Label runat="server" ID="Label1" Text="Update your professional experience below"></asp:Label>
<asp:UpdatePanel runat="server" ID="upExperience">
<ContentTemplate>
<asp:DropDownList runat="server" AutoPostBack="true" ID="ddlCategory">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="ddlValues">
</asp:DropDownList>
<asp:Button runat="server" ID="btnAddNew" Text="Add New" />
<asp:GridView runat="server" ID="gvExperience" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Category" HeaderText="Category" />
<asp:BoundField DataField="Experience" HeaderText="Experience" />
<asp:BoundField DataField="Status" HeaderText="Status" />
<asp:TemplateField HeaderText="Remove">
<ItemTemplate>
<asp:ImageButton runat="server" ID="btnRemove" CommandArgument="<%#Eval("ID")%>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" ID="upp">
<ProgressTemplate>
<img src="../Images/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</td>
</tr>
Your ImageButton server control is not well formed because of the double qoutes surroundings the Eval, so the asp:UpdateProgress is being seen as the continuation of the tag. Replace with this:
<asp:ImageButton runat="server" ID="btnRemove" CommandArgument='<%#Eval("ID")%>' />

Timer control triiggers updatepanel in 5 seconds and I get a sys.webforms,PageRequestManagerServerErrorException

<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ChatUserControl.ascx.cs"
Inherits="MetamorphismApp.ChatUserControl" %>
<asp:Timer ID="timer1" runat="server" OnTick="timer1_Tick" Interval="5000">
</asp:Timer>
<div id="divChatWindow" class="clChatWindow">
<div>
<asp:Label runat="server" Text='<%# Eval("username") %>' class="divHeader" ID="lblChatFriend"></asp:Label>
<asp:Image ID="imgFriend" runat="server" CssClass="classFriendImage" />
<asp:LinkButton ID="lbClose" runat="server" CommandName="Close" CssClass="lbClose"
OnClick="lbClose_Click">Close</asp:LinkButton></div>
<div class="chatText" id="idChatText" runat="server">
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="timer1" EventName="Tick" />
<asp:AsyncPostBackTrigger ControlID="btnSendChat" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Repeater runat="server" ID="rpChatMessages">
<ItemTemplate>
<asp:Image ID="imageForFriend" runat="server" CssClass="clFriendsImage" ImageUrl='<%# "HttpImageHandler.jpg?username=" + DataBinder.Eval(Container.DataItem,"fromusername").ToString() %>' />
<asp:Label ID="chatMessage" runat="server" Text='<%# Eval("Message") %>'></asp:Label>
<br>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:TextBox ID="txtChatMessage" runat="server" Width="142px" CssClass="clChatMessage" EnableViewState="true"
TextMode="MultiLine"></asp:TextBox>
<asp:LinkButton ID="btnSendChat" runat="server" CommandName="Insert" CommandArgument='<%# Eval("username") %>'
OnClick="btnSendChat_Click" CssClass="btnSendChat">Send</asp:LinkButton>
</div>
I want to use updatepanel triggered by a timer control and after 5 seconds I get a sys.webforms error. I dont wanna populate my repeater using a webservice to be called via jquery and binding the data to the repeater. I want to use the updatepanel for data population. I have read several articles to avoid this error but havent found a solution yet. If I change asyncpostback trigger to postbacktrigger the page does a postback which I dont want to happen. I want to use updatepanel to solve this issue. What should I do?
It looks like you forgot to put ScriptManager control on your page.
I am getting error 503 status code. To my surprise if you are facing this error issue on the server then this issue is a server's issue and not your coding issue. Status 503 indicates that the server cannot fulfill the request and it gives this error. Try contacting your hosting provider.

Why can I not unregister my UpdatePanel when it was not registered with the ScriptManager?

I am using the modal pop up in the code below. I am getting the following error:
Cannot unregister UpdatePanel with ID 'updatePnl' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel
What could be causing this?
Here is my code:
<telerik:GridTemplateColumn HeaderStyle-Width="20%" HeaderText="See Your Assessment">
<ItemTemplate>
<asp:Button CommandName="Show" OnClick="grdMasterbtnClick" CommandArgument='<%#Eval("SurveyClientID")%>'
ID="btn" runat="server" Text="Your Assessment" />
<cc1:ModalPopupExtender CancelControlID="btnCancel" PopupControlID="modelPopUp" ID="ModalPopupExtender1"
runat="server" TargetControlID="imgClientFreeEval">
</cc1:ModalPopupExtender>
<asp:UpdatePanel ID="updatePnl" runat="server">
<ContentTemplate>
<asp:Panel ID="modelPopUp" runat="server" Visible="false" BackColor="AliceBlue">
<p>
These items will be permanently deleted and cannot be recovered. Are you sure?
</p>
<asp:Button ID="btnOk" Text="OK" runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" runat="server" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
<HeaderStyle Width="20%"></HeaderStyle>
</telerik:GridTemplateColumn>

Update Panel not working correctly?

I have added two update panels to my page. I'm trying to update the first panel but not the second. The second panel contains validation controls which seem to be kicking in no matter what I try.
Code
<asp:ToolkitScriptManager runat="server" ID="ScriptManager" />
<asp:UpdatePanel ID="updatePnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:label ID="NoConsignments" runat="server" ForeColor="red" />
<br />
<asp:TextBox ID="StartDate" runat="server" /> <asp:TextBox ID="EndDate" runat="server" /> <asp:Button ID="Dates" OnClick="btDates" runat="server" Text="Search" />
<asp:calendarextender ID="Calendarextender2" targetcontrolid="StartDate" Format="dd/MM/yyyy" runat="server"></asp:calendarextender>
<asp:calendarextender ID="Calendarextender3" targetcontrolid="EndDate" Format="dd/MM/yyyy" runat="server"></asp:calendarextender>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Dates" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
I've left out some of the middle code of there is alot. If you would like any more code please let me know.
Am I missing something? or is this not the way that update panels should be used?
Thanks you so much for any help you can provide
I would guess that the validation controls in the second UpdatePanel are firing their client-side validation methods (so the update panel isn't posting back, which is correct).
You might be able to get around this by using the ValidationGroup property - assign the validation controls in the first update panel to one validation group (e.g. "ValidationGroupA"), and the validation controls in the second update panel to another validation group.
I haven't used UpdatePanels for a while, and you haven't included the mark up for the validators in the second panel.
However it looks to me like you might not be adding groups to your validation see this tutorial
e.g.:
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" ValidationGroup="First"/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ValidationGroup="First" ErrorMessage="TextBox1 should not be blank"
ControlToValidate="TextBox1"/>
<asp:Button ID="Submit1" runat="server" ValidationGroup="First"
Text="Submit 1"/>
<asp:TextBox ID="TextBox3" runat="server" ValidationGroup="Second"/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage=" TextBox3 should not be blank"
ControlToValidate="TextBox3" ValidationGroup="Second"/>
<asp:Button ID="Submit2" runat="server" ValidationGroup="Second"
Text="Submit 2"/>
</div>
</form>
</body>
Hope this helps and I haven't missed the point.
You have to specify ValidationGroups for your Buttons and Validators, f.e. Panel1 for your Searchbutton and Panel2 for your Validators in second UpdatePanel.
<asp:Button ID="Dates" ValidationGroup="Panel1" runat="server" Text="Search" />
....
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ValidationGroup="Panel2" ErrorMessage="RequiredFieldValidator"
ControlToValidate="TextBox1" />
</ContentTemplate>
</asp:UpdatePanel>

Resources