At first I was having problems with forcing the TabContainer to show. Apparantly something caused it to render as 'style="visibility: hidden"' on runtime. However I fixed this by adding style="visibility:visible" to the TabContainer. It looks like this now:
<asp:TabContainer ID="TabContainer1" runat="server" style="visibility:visible">
<asp:TabPanel ID="TabPanel1" HeaderText="Tab 1" runat="server">
<ContentTemplate>
contents of tab 1 <br />
contents of tab 1 <br />
contents of tab 1 <br />
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel2" HeaderText="Tab 2" runat="server">
<ContentTemplate>
contents of tab 2 <br />
contents of tab 2 <br />
contents of tab 2 <br />
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel3" HeaderText="Tab 3" runat="server">
<ContentTemplate>
contents of tab 3 <br />
contents of tab 3 <br />
contents of tab 3 <br />
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
Now it does show. but whenever I press tab 2 or 3, nothing happens. It still shows 'contents of tab 1'.
How do I fix this? I would love to have a working TabContainer!
Your code worked for me as-is in Visual Studio 2012. The only thing I did was add the ScriptManager.
<ajaxToolkit:ToolkitScriptManager runat="server" />
If you are using .net 4.0/4.5, check that you have added AjaxTookitScriptManager (and not ScriptManager usually added in .net 2.0). I ran into the same problem and figured that out from this notes: http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit
Below is an elaborate procedure that worked for me:
Create a new web site/application in VS 2012
Install AjaxToolKit using NuGet (I do mine like this: Tools Menu > Library Package
Manager. then in the prompt I type 'Install-Package
AjaxControlToolkit' to install it)
In the ToolBox window, right click the Ajax Tools or any preferred folder, Choose Items... > Browse... to the Bin folder where the AjaxToolkit.dll should now exist and add it
Create a new WebForm Drag and drop AjaxTookitlScriptManager to the page
Drag and drop TabControl from the ToolBox. Add tabs to it and set
its width, eg to 500px Test and it should work
I have the same problem with the same control Instead of using ScriptManager , try using ToolkitScriptManager . so this may be a similar issue.
<asp:ToolkitScriptManager runat="server">
</asp:ToolkitScriptManager>
if there is a problem pop ups to you , try to re attached the latest realese of Ajax Control toolkit (I had the same problem and it is done by doing this)
http://ajaxcontroltoolkit.codeplex.com/releases/view/116091
I wish I can help :).
Related
i want to popup ModalPopupExtender in button click, but when i run my code and click on the button then ModalPopupExtender is not popup even i used all the required AjaxControlToolkit references for this
my code is following :
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:Panel ID="Panel1" runat="server" BackColor="#CC3300">
hello...
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="click here" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Button1">
</asp:ModalPopupExtender>
</div>
</form>
i am using the visual studio 2008 Pro., .Net Framework 3.5 and for Ajax i used AjaxControlToolkit.dll(3.5.60919.0)
sir, plz give me solution for this..
it can be your tags, try ajaxToolkit instead of asp tag
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Button1">
</ajaxToolkit:ModalPopupExtender>
I believe your workaround lies here:
unknown server tag modalpopupextender
The error is related to the use of a master page in your site and was reportedly going to be fixed in a Visual Studio service pack (as of 2007, but not yet as of VS 2010 SP1). There is a simple workaround though that works for some folks (and did for me):
Open the master page first, then open the page with your ModalPopupExtender in it.
Need to include the below line in your aspx page at the top .
Just change the version according to your's.
<%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.1.7.1005, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
I'm having surprisingly bad luck finding a decent resource for this. But What I'm doing is creating a list of tickets using a ListView. One of the controls in the item template is a link button that shows the header of the ticket. When the user clicks the link button, I want to open a modal window that shows the ticket in readable format. To get the ticket, I'll be passing that page a variable and it'll do the rest; nothing complicated. The page will have 3 buttons and the windows needs to close when you click one of them.
Now, I figured out how to use the ModalPopupExtender from the Ajax tookit more or less. You create the panel in it's own div which stays hidden. I created a click event that basically uses a webclient to download the html from the page and insert it into that div's innerHtml. This seems to work the first time. But as soon as you click a different link, the page pukes and says something about it being in an illegal state.
I'm not sure if I'm going about this wrong, and I can't find any decent examples of how to do this. Well there's one, but the english is hard to understand and it's in VB instead of C#. Any help?
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<br />
<asp:ModalPopupExtender
DropShadow="true"
OkControlID="btnOk"
CancelControlID="btnClose"
runat="server"
PopupControlID="Panel1"
id="ModalPopupExtender1"
TargetControlID="Button1" />
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none;">
This is basic modal popup.
<br /><br />
<asp:Button ID="btnOk" runat="server" Text="Ok" />
<asp:Button ID="btnClose" runat="server" Text="Close Me" />
<iframe src="http://www.google.com"></iframe>
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="First Modal Popup" />
</div>
</form>
Try this it should work.
This is not just another FileUpload + UpdatePanel question.
I have, as stated in the many similar posts, an UpdatePanel and a FileUpload control on my form. I also have a PostBackTrigger set up for my upload button.
It works. The catch is it never does work on first time click. That is:
I click on browse, select my file, press upload. Nothing happens (fupld.HasFile = false);
I click on browse again, select any file (the same or another), press upload and it works fine.
<asp:UpdatePanel ID="upGeneral" runat="server" >
<ContentTemplate>
...
<table id="tabPage10" runat="server" visible="false" width="100%" >
<tr>
...
<td>
<asp:FileUpload ID="fupld" runat="server" Width="80%" />
<asp:ImageButton ID="ibtnUpld" runat="server" onclick="ibtnUpld_Click" />
<td>
...
<tr>
...
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ibtnUpld" />
</Triggers>
</asp:UpdatePanel>
I've looked around for answers, but this is some really weird behaviour. No luck so far.
Any ideas?
Thanks
Well, the FileUpload control is designed to be used only in postback scenarios and not in asynchronous postback scenarios during partial-page rendering.
http://msdn.microsoft.com/en-us/ysf0192b#using_the_FileUpload_Control_with_the_UpdatePanel_control
You could use the AsyncFileUpload control instead from the AjaxControlToolkit.
<asp:AsyncFileUpload runat="server" ID="asyncFileUpload" Width="400px" ThrobberID="imageThrobber"
OnClientUploadStarted="uploadStarted" OnClientUploadError="uploadError"
ClientIDMode="AutoID" PersistFile="true" PersistedStoreType="Session" />
code behind:
if (asyncFileUpload.HasFile)
{
string fullPath = GetPath(asyncFileUpload.FileName);
asyncFileUpload.SaveAs(fullPath);
}
I've never had any problems with it.
With Post back triggers I had to use the below line of code in code behind:
Page.Form.Enctype = "multipart/form-data";
And this works perfectly fine.
Thanks to the solution in the link - (http://patelshailesh.com/index.php/file-upload-control-fails-first-time-then-works-on-subsequent-submits).
Change
Visible ="false"
to
style="display:none"
and change it from code behind.
If you set Visible="false, control is not actually rendered as HTML. To rendered it as HTML, use style = "display:none" instead of Visible="false"
I have divised a page with a TabContainer.
Before, this page worked with a CascadingDropDown that populate a DropDownList.
Now this DropDownList is in another tab. So I catch an exception "Object Reference Null" when I try to see this page.
How did runs to load a DropDownList in another Tab when I change a value in a different Tab ?
Update:
Thanks for your answer, but unfortunaly it doesn't work.
I have tried with CascadingDropDownExtender outside the TabContainer, but Reference null is catched again.
With CascadingDropDownExtender in same Panel as child DropDownList, I have a javascript alert that say Parent Control not found.
Here the code with CascadingDropDownExtender in same Panel as child DropDownList
<cc2:TabPanel runat="server" HeaderText="Carte Identité" ID="TabCI">
<ContentTemplate>
<ProspectMgt:MarketSegmentDropDownList ID="MarketSegmentDropDownList1" runat="server"
AutoPostBack="false" Width="400px"></ProspectMgt:MarketSegmentDropDownList>
<asp:CompareValidator ID="CompareValidator2" runat="server" CssClass="error" ToolTip="Required"
ControlToValidate="MarketSegmentDropDownList1" ValueToCompare="-1" Operator="NotEqual"
ErrorMessage="MktSegment" Display="Dynamic" Font-Bold="True"></asp:CompareValidator>
</ContentTemplate>
</cc2:TabPanel>
<cc2:TabPanel ID="TabSize" runat="server" HeaderText="Size & Volume">
<ContentTemplate>
<asp:DropDownList ID="DropDownListSize" AutoPostBack="false" runat="server">
</asp:DropDownList>
<cc2:CascadingDropDown ID="cddSize" runat="server" TargetControlID="DropDownListSize"
Category="Size" LoadingText="[...]"
ServicePath="~/Modules/ProspectMgt/WebService/ServiceAjax.asmx" ServiceMethod="GetSizeByMktId"
ParentControlID="MarketSegmentDropDownList1" />
</ContentTemplate>
</cc2:TabPanel>
So I don't see why it is not working. It was working perfectly without TabContainer. I'm using AjaxToolKit 30512. However, I'm looking to drop CascadingDropDownExtender and manage this issue by javascript only.
Is the CascadingDropDownExtender inside the first tab? If it is, if you pull the CascadingDropDownExtender outside the tab container altogether, does that fix the issue? Posting some markup would help resolve this more easily...
HTH.
Update:
There was actually a hidden panel with validator in the user control that was causing page not to be valid on the first postback. Consider this issue resolved.
This is first time I am using this control and it is behaving rather strange. I have to click on the "Next" button twice for it to move to the next step. I tried explicitly setting active index, using MoveTo etc. Nothing works. Here is the markup for the control. Anybody has any ideas why?
<asp:Wizard ID="UserWizard" runat="server" ActiveStepIndex="0"
StartNextButtonImageUrl = "~/App_Themes/Default/images/buttons/continue.gif" StartNextButtonType="Image"
StepNextButtonType="Image" StepNextButtonImageUrl="~/App_Themes/Default/images/buttons/continue.gif"
FinishPreviousButtonImageUrl="~/App_Themes/Default/images/buttons/back.gif"
FinishPreviousButtonType="Image" FinishCompleteButtonImageUrl="~/App_Themes/Default/images/buttons/save.gif"
FinishCompleteButtonType="Image" CancelButtonType="Image" CancelButtonImageUrl="~/App_Themes/Default/images/buttons/back.gif"
DisplaySideBar="false" >
<WizardSteps>
<asp:WizardStep Title="User Profile" ID="UserProfile" runat="server">
<uhc:ctlUserProfileEdit ID="ctlUserProfileEdit" runat="server">
</uhc:ctlUserProfileEdit>
<br clear="all" />
<div>
<asp:ImageButton ID="cmdResetPassword" runat="server" ImageUrl="~/App_Themes/Default/images/buttons/resetpassword.gif" />
</div>
<div>
<asp:UpdatePanel ID="upSchools" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<uhc:ctlSchoolLocationSelector ID="ctlSchoolLocationSelector" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:WizardStep>
<asp:WizardStep Title="Roles" ID="Roles" runat="server">
<uhc:ctlPermissionInternal ID="ctlPermissionInternal1" runat="server"></uhc:ctlPermissionInternal>
<uhc:ctlPermissionExternal ID="ctlPermissionExternal1" runat="server"></uhc:ctlPermissionExternal>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
I don't know for sure if this is what's causing it, but I find it strange that there is an UpdatePanel within the Wizard control, rather than the Wizard Control within the update panel. This may be causing some strange behavior.
Can you change this and see if the problem resolves itself?