Showing posts with label public. Show all posts
Showing posts with label public. Show all posts

Wednesday, March 21, 2012

Parser Error Message: Type System.Web.UI.UpdatePanel does not have a public property named

Hi, first post...I am fairly new to ajax and was looking for some guidance on my problem. I installed the 3 files (Ajax 1.0 RC, Toolkit and the Futures December CTP). I wanted to convert an exsisting and working .net 2.0 sample aspx page into AJAX to learn how the updatepanels work. The page contains a bunch of datagrids that i wanted to place inside "updatepanels".

However, I keep getting the parser error"Type 'System.Web.UI.UpdatePanel' does not have a public property named 'datagrid'." whenever I placeanything inside the panels (table, div, tr...etc). I am sure its a pretty straight forward problem but not sure where to start looking.

If it matters, my solution in MS Visual Studio does not include a BIN folder. (something tells me i need it) I created a "New Website" and selected "AJAX-enabled website" and went from there. I could not find templates to start working from.

Thanks in advance!
Skimo!

<

asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<

asp:datagridid="results"runat="server"GridLines="Horizontal"BorderWidth="2px"BorderColor="#f4f4f4"CellPadding="5"CellSpacing="0"AlternatingItemStyle-BackColor="#EAEAFF"ShowHeader="False"Width="100%"Autogeneratecolumns="False"AllowPaging="true"BorderStyle="Solid"PageSize="25"OnPageIndexChanged="results_Paging"><columns><asp:TemplateColumnItemStyle-Width="15%"><ItemTemplate>

<%

# DataBinder.Eval(Container.DataItem,"createdate") %></ItemTemplate></asp:TemplateColumn><asp:TemplateColumnItemStyle-Width="15%"><ItemTemplate>

<%

# DataBinder.Eval(Container.DataItem,"name") %></ItemTemplate></asp:TemplateColumn><asp:TemplateColumnItemStyle-Width="70%"><ItemTemplate>

<%

# DataBinder.Eval(Container.DataItem,"comment") %></ItemTemplate></asp:TemplateColumn>

</columns><PagerStyleMode="NumericPages"HorizontalAlign="Center"/>

</

asp:datagrid>

</

asp:UpdatePanel>

you cant load datagrid in the page.load when its inside of UpdatePanel.

This is because UpdatePanel gets call first before the grid gets load. Thats is why it couldnt find it.

you can have button inside of updatepanel, when you click the button the it will do databind with grid


It is indeed a straightforward problem. Everything inside an UpdatePanel goes inside a "ContentTemplate", like this:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DataGrid ...>
</asp:DataGrid>
</ContentTemplate>
</asp:UpdatePanel>


Thank you so much!! I learned something :)

Does this mean I do not need to worry about the BIN folder not being there?

-Skimo


You won't need a bin folder to just use ASP.NET AJAX itself, since it gets installed globally for the machine.

If you use the AJAX Control Toolkit or the December Futures CTP, then your project will need to have the appropriate binaries in the bin folder.

I'm glad you're off and running... good luck exploring ASP.NET AJAX!


Great thanks for your help!

Skimo

Partial rendering doesnt update the javascript...

Hello all,

I am using an UpdatePanel where I have used a server side public variable in javascript function like,

<

scriptid="Infragistics"type="text/javascript">

var myValue = "<%=ServerVariable%>";

</script>

First time, when the page is fetched, myValue contains a value. After the asynch Postback the ServerVariable changes on server side, but the javascript is not updated after partial rendering and myValue contains the previously rendered value. Is there any way to refresh the script block again after every partial rendering?

Thanks in Advance.

Mudassar Majeed

Instead of puttong the script tags, please generate the script in a string and use ScriptManager.RegisterClientScriptBlock function to register the script.
Thanks alot, it worked fine.