[Mono-dev] System.Web.Extensions testing under mojoPortal

Onur Gumus emperon at gmail.com
Wed Aug 29 07:44:11 EDT 2007


Hey,

Almost same result here (though I tried with ordinary ASP.NET applications).
Unfortunately without  the blow is fixed

>  I encountered a bug that needs to be fixed but was able to work around
it.
> The bug was a null reference on any controls inside the UpdatePanel
> and the workaround was to get the needed reference using
> UpdatePanel1.FindControl(...)

it is not very usable. You know it is overkill to use FindControl everytime
you want to access the controls in the page


Onur



On 8/29/07, Joe Audette <joe.audette at gmail.com> wrote:
>
> Hi All,
>
> Yesterday I managed to get UpdatePanel working in mojoPortal using
> Mono from svn r84961 and mojoportal from svn trunk:
> https://forgesvn1.novell.com/svn/mojoportal/trunk
>
> I encountered a bug that needs to be fixed but was able to work around it.
> The bug was a null reference on any controls inside the UpdatePanel
> and the workaround was to get the needed reference using
> UpdatePanel1.FindControl(...)
> Relevant code from BlogEdit.aspx and BlogEdit.aspx.cs:
>
> <asp:TextBox id="txtCategory" runat="server" Columns="50"></asp:TextBox>
>                             <asp:Button  id="btnAddCategory"
> runat="server"></asp:Button>
>                 <div class="settingrow">
>                             <asp:UpdatePanel ID="UpdatePanel1"
> UpdateMode="Conditional"
> runat="server">
>                 <ContentTemplate>
>                     <asp:CheckBoxList id="chkCategories"
> runat="server" SkinID="Blog"></asp:CheckBoxList>
>                 </ContentTemplate>
>                 </asp:UpdatePanel>
>
> private void Page_Load(object sender, EventArgs e)
> {
>
>     if (ScriptController != null)
>     {
>         ScriptController.RegisterAsyncPostBackControl(btnAddCategory);
>     }
>     else
>     {
>         log.Error("ScriptController was null");
>     }
>
>     if ((!Page.IsPostBack) && (!Page.IsCallback))
>     {
>         PopulateControls();
>         PopulateCategories();
>     }
>
> }
>
> private void PopulateCategories()
>                 {
>             // Mono doesn't see this in update panel
>             // so help find it
>             if (chkCategories == null)
>             {
>                 log.Error("chkCategories was null");
>
>                 chkCategories =
> (CheckBoxList)UpdatePanel1.FindControl("chkCategories");
>             }
>
>             if (ShowCategories)
>             {
>                 chkCategories.Items.Clear();
>                 IDataReader reader;
>                 reader = Blog.GetCategoriesList(this.ModuleID);
>                 while (reader.Read())
>                 {
>                     ListItem listItem = new ListItem();
>                     listItem.Text = reader["Category"].ToString();
>                     listItem.Value = reader["CategoryID"].ToString();
>                     chkCategories.Items.Add(listItem);
>                 }
>                 reader.Close();
>
>                 if (this.ItemID > -1)
>                 {
>                     reader = Blog.GetItemCategories(this.ItemID);
>                     while (reader.Read())
>                     {
>                         ListItem item =
> chkCategories.Items.FindByValue(reader["CategoryID"].ToString());
>                         if (item != null)
>                         {
>                             item.Selected = true;
>                         }
>                     }
>                     reader.Close();
>                 }
>
>             }
>
>                 }
>
> protected void btnAddCategory_Click(object sender, EventArgs e)
>                 {
>
>             if (this.txtCategory.Text.Length > 0)
>             {
>                 int newCategoryID =
> Blog.AddBlogCategory(this.ModuleID, this.txtCategory.Text);
>                 if (this.ItemID > 0)
>                 {
>                     Blog.AddItemCategory(this.ItemID, newCategoryID);
>                 }
>
>                 PopulateCategories();
>                 UpdatePanel1.Update();
>
>             }
>
>                 }
>
>
> With the workaround it does work on Mono. Even without the workaround
> it worked on Windows using the Mono System.Web.Extensions.dll
>
> When I tried to use the same dll on Mono 1.2.4 vm it did not work, it
> compiled ok but at runtime I got an error about unkown type
> System.Web.UI.Literal. I think the issue on 1.2.4 has to do with this
> in Web.config:
> <add tagPrefix="asp" namespace="System.Web.UI"
> assembly="System.Web.Extensions"/>
>
> Seems to lose track of all other controls in asp prefix that are not
> in the System.Web.Extensions.dll. A workaround might be to use a
> different prefix like ajax instead of asp.
>
> I've been waiting a long time to be able to use UpdatePanel and other
> MS Ajax stuff in mojoportal so I'm very happy to have progress but
> would like to be able to use it more extensively without having to
> .FindControl every control in the updatepanel
>
> Thanks,
>
> Joe
>
> --
> Joe Audette
> Software Solutions Architect
> Source Tree Solutions, LLC
> joe.audette at gmail.com
> http://www.sourcetreesolutions.com
> http://www.mojoportal.com
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



-- 
Warning: If you are reading this then this warning is for you. Every word
you read of this useless fine print is another second off your life. Don't
you have other things to do? Is your life so empty that you honestly can't
think of a better way to spend these moments? Or are you so impressed with
authority that you give respect and credence to all that claim it? Do you
read everything you're supposed to read? Do you think every thing you're
supposed to think? Buy what you're told to want? Get out of your apartment.
Meet a member of the opposite sex. Stop the excessive shopping and
masturbation.Quit your job. Start a fight. Prove you're alive. If you don't
claim your humanity you will become a statistic. You have been warned - Onur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070829/4a1a3c46/attachment.html 


More information about the Mono-devel-list mailing list