Showing posts with label pages. Show all posts
Showing posts with label pages. Show all posts

Wednesday, March 28, 2012

Change content pages of Master Page without Master Page posting back?

so Master + content pages seems like exactly what I want except that they are assembled on postbacks. I am trying to make a site where both Master and Content pages have updatepanels, and the site switches content pages (40+ content pages) without the master page refreshing. Master Pages are assembled on postbacks so I don't think simple master page will work without annoying postbacks. I tried an approach where load content pages inside an Iframe, but the content pages take too long to load becuase each content page loads its own scriptmanager. View/Multiview will probably work but difficult to develop a 40 view multiview, I would rather develop 40 separate aspx pages. Any ideas on making any of these three approaches work well? either fix masterpage postback, or fix Iframe load times, or fix View/Multiview eaase of development?

THanks!

Todd Wilder

I think you are looking at the problem backwards - you have to change the MasterPage of the content page. this.Page.MasterPageFile property.

Another option which I successfuly have deployed is dynamically loading a usercontrol into a placeholder on the masterpage.

Monday, March 26, 2012

centered update progress

Hi;

I usually have my update progress control on the top of the page but on long pages, the user can't see it.

On codeplex.com, when i insert some text on "Search Projects" (upper right) and hit the search button, an "Updating" message is showed on the center of the page and the rest of the page becomes gray. Can i get this same result using AJAX update progress?

Thanks in advance;

If that is what you want, you should probably use the ModalPopup control. Try it at: http://asp.net/AJAX/Control-Toolkit/Live/ModalPopup/ModalPopup.aspx


Pls checkout this link, it got some cool example of Moal Popup extenderhttp://mattberseth.com/blog/modalpopupextender


See this link for AJAX Progress bar in the middle of page

http://www.ajaxium.com/ajax-for-asp.net.aspx

Saturday, March 24, 2012

CascadingDropDownList going against SQLServer in VB

I tried to find an answer to this problem by searching through the site; however, I gave up after plowing through eleven pages returned from the forums, especially since there were 3,604 entries. Anyway, here goes...

I'm working on a website and want to use the CascadingDropDownList extender going against some tables in SQL Server 2005. I've found some C# code that'd do the trick, but my current employer uses only VB .Net, so I'm stuck with it. The problem occurs inside the Web Service function when I attempt to return the results from my Web Service to my form. The code is as follows:

<WebMethod()> _
PublicFunction GetEntityTypes(ByVal valuesAsString,ByVal idAsInteger)As AjaxControlToolkit.CascadingDropDownNameValueDim categoryValuesAsString() = values.Split(":"c, ";"c)
Dim entityIDAsInteger =CType(categoryValues(1),Integer)
Dim entitiesAs Generic.List(Of CascadingDropDownNameValue) =New Generic.List(Of CascadingDropDownNameValue)
Dim drAs SqlDataReader = SqlDataAccess.ExecuteReader(_connString, CommandType.StoredProcedure, _
"Entity.GetEntityTypes")

While dr.Read()
entities.Add(New CascadingDropDownNameValue(dr("EntityTypeID"), dr("EntityType")))
EndWhile

Return entities ' The problem occurs here regardless of whether I'm trying to return entities or entities.ToArray()

EndFunction

Has anyone done this in VB? If so, what am I doing wrong? If you have any code you could share, that'd also be greatly appreciated! Big Smile

What is the error that you get?


If I try just returning entities, I get:
Value of type 'System.Collections.Generic.List(Of AjaxControlToolkit.CascadingDropDownNameValue)' cannot be converted to 'AjaxControlToolkit.CascadingDropDownNameValue'.

If I try returning entities.ToArray(), I get:
Value of type '1-dimensional array of AjaxControlToolkit.CascadingDropDownNameValue' cannot be converted to 'AjaxControlToolkit.CascadingDropDownNameValue'.

From what I've seen in the C# version, they're creating a List<T> of CascadingDropDownNameValue, along the line of
List<CascadingDropDownNameValue> entities = new List<CascadingDropDownNameValue>()

thus my attempt to use the line
Dim entitiesAs Generic.List(Of CascadingDropDownNameValue) =New Generic.List(Of CascadingDropDownNameValue)

It looks like I've finally found the answer! I declared entities thusly:
Dim entites = new Generic.List(Of CascadingDropDownNameValue)()
and the project compiled. Whether it runs or not remains to be seen.

Nope, now I'm getting a System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List`1[AjaxControlToolkit.CascadingDropDownNameValue]' to type 'AjaxControlToolkit.CascadingDropDownNameValue'.

I wish I could do this in C# since I've been using it the last three years after having programmed in VB.NET the previous two, but I can't since the company is using VB.NET on all of it's Web development.


The problem is in the declaration of the function. You are returning the right thing List<CascadingDropDownNameValue> (in C#) but this is not what you define in the function declaration.

You need to change it to as List(Of CascadingDropDownNameValue)

Public Function GetEntityTypes(ByVal valuesAs String,ByVal idAs Integer)As AjaxControlToolkit.CascadingDropDownNameValue

Becomes

Public Function GetEntityTypes(ByVal valuesAs String,ByVal idAs Integer)As List(Of AjaxControlToolkit.CascadingDropDownNameValue)

HTH,

Jonathan.

Wednesday, March 21, 2012

CascadingDropDown problem with the v1.0 version

Hi all,

in one of my pages, i have two dropdowns: one for listing countries and the second for listing the states/provinces of the country selected in the first one dropdown.

When i was using the AJAX Release candidate version, I used the cascadingdropdown without problem. But when i installed the v1.0, the cascadingdropdown stop updating the second dropdown, as used to. Is there someone who can tell me what i am doing wrong?

Part of my code in the aspx file:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel id="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>

<TABLE style="WIDTH: 100%; TEXT-ALIGN: left">
<TBODY> <TR>
<TD style="WIDTH: 328px; TEXT-ALIGN: left">
<asp:DropDownList id="CountryDropDownList" tabIndex=12 runat="server" Width="204px" AutoPostBack="True" DataTextField="Name" DataValueField="Id"></asp:DropDownList>
</TD>

<TD style="WIDTH: 328px; HEIGHT: 24px; TEXT-ALIGN: left">
<asp:DropDownList id="ProvinceDropDownList" tabIndex=12 runat="server" Width="204px" DataTextField="Name" DataValueField="Id"></asp:DropDownList>
</TD>
</TBODY>
</TABLE>

<cc1:CascadingDropDown id="CascadingDropDown1" runat="server" TargetControlID="CountryDropDownList" Category="Country" ServicePath="CustomerSignUp.aspx" ServiceMethod="GetAllCountries" PromptText="<%$ Resources:Messages, SelectCountry %>" LoadingText="<%$ Resources:Messages, Loading %>"></cc1:CascadingDropDown>

<cc1:CascadingDropDown id="CascadingDropDown2" runat="server" TargetControlID="ProvinceDropDownList" Category="Province" ServicePath="CustomerSignUp.aspx" ServiceMethod="GetCountryProvinces" PromptText="<%$ Resources:Messages, SelectProvince %>" LoadingText="<%$ Resources:Messages, Loading %>" ParentControlID="CountryDropDownList"></cc1:CascadingDropDown>

</ContentTemplate>
</asp:UpdatePanel>

</asp:Content>

Methods in the aspx.cs file:

[WebMethod]
public static CascadingDropDownNameValue[] GetAllCountries(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
ICollection<Country> countries = KinocastFacade.Instance.GetAllCountries();
foreach (Country country in countries)
{
values.Add(new CascadingDropDownNameValue(
Resources.Messages.ResourceManager.GetString(country.Name), country.Id.ToString()));
}

return values.ToArray();

}

[WebMethod]
public static CascadingDropDownNameValue[] GetCountryProvinces(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(
knownCategoryValues);
int countryId;

/*Verifica se a chave country está no StringDictionary e se é possivel
*fazer o parse do seu valor para inteiro. Se possivel coloca o valor
*em countryId*/
if (!kv.ContainsKey("Country") ||
!Int32.TryParse(kv["Country"], out countryId))
{
return null;
}

List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
ICollection<Province> provinces = KinocastFacade.Instance.GetCountryProvinces(countryId);
foreach (Province province in provinces)
{
values.Add(new CascadingDropDownNameValue(
Resources.Messages.ResourceManager.GetString(province.Name), province.Id.ToString()));
}

return values.ToArray();
}

Thanks a lot for any help,

Rodrigo

Anyway,

I've just resolved my problem re-creating the project, including all my files and modules again. And at the end, i include the AjaxControlToolkit.dll (version 1.0.10301.0) and the cascadingdropdown problem disapeared.

Maybe, it had happened because the VS saves some olds DLLs in a limbo place :p ...... I dont know...

Cheers.