.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Need some help with the AnimationExtender controls in C# code behind only

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net

Hi all,

I'm developing a custom webpart for MS Project 2007 (sharepoint 2007 engine). I would like to have exactly the same result as this demonstration -> http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Animation/Animation.aspx but the window is displaying above my button and not correctly. I need your help, please.

Here is my code:

Literal div1 = new Literal();

            div1.Text = "";
            div1.Text += "<div id='flyout' style='display: none; overflow: hidden; z-index: 2; background-color: #FFFFFF; border: solid 1px #D0D0D0;'></div>";

            div1.Text += "<div id='info' style='display: block; width: 250px; z-index: 2; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); font-size: 12px; border: solid 1px #CCCCCC; background-color: #FFFFFF; padding: 5px;'>";
            div1.Text += "    <div id='btnCloseParent' style='float: right; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);'>X";
            div1.Text += "        <a onclick='return false;' id='btnClose' title='Close' href='#' style='background-color: #FF5B00; color: #000000; text-align: center; font-weight: bold; text-decoration: non

View Complete Post

More Related Resource Links

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)


Hey guys

I came across this bug using while trying to implement a sitemap

Line 147:						Panel panel = new Panel();
Line 148:						panel.Controls.Add(_viewState);
Line 149:						Page.Form.Controls.Add(panel);
Line 150:						string script = "document.getElementById('" + _viewState.ClientID + "').value = GetViewState__AspNetTreeView('" + Extender.MakeChildId("UL") + "');";
Line 151:						Page.ClientScript.RegisterOnSubmitStatement(typeof(TreeViewAdapter), _viewState.ClientID, script);

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +8696951
   CSSFriendly.TreeViewAdapter.SaveAdapterViewState() in E:\wwwroot\ThirdParty\CSSFriendly\CSSFriendly_24242\CSSFriendly\TreeViewAdapter.cs:149
   System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +8901848
   System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
   System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
   System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148

Toolbox: Microsoft Chart Controls, Visual Studio Automatic Code Snippets, And More


In this installment we look at the Microsoft Chart Controls; Snippet Designer, a free, add-in for Visual Studio 2008 for creating and editing Code Snippets; refactoring SQL applications; and this month's favorite blog.

Scott Mitchell

MSDN Magazine April 2009

Wicked Code: Craft Custom Controls for Silverlight 2


If you're unfamiliar with Windows Presentation Foundation (WPF), building that first Silverlight custom control can be a daunting experience. This article walks through the process.

Jeff Prosise

MSDN Magazine August 2008

Code from the ground up, or use just populate placed controls?


As an Ex ASP Classic moving to ASP.net (VB) i find the following situation, and i'm looking for some direction in terms of best practice.  

As i'm sure we all do when we start, i easily get lost in all the controls and clever wizard driven development features.  however, my best .net work so far has been without any drag/dropped controls, but rather programatically creating whatever controls/connections/dataobjects i need, populating, acting on and disposing of thereafter.

There was a post i saw (somewhere) which referred to the sqldatasource and gridview controls and their consorts as "training wheels" controls and i identified with that statement straight away.

Now here's the question: is this a question of arbitrary "preference" or is this something that has larger implications later on?   I realize that it's a kind of up-in-the-air question, but I don't want to be more specific than that in my question because I want to see what others think about this.

Do you have to instantiate all objects/controls on the webform in the behind code page?


Hello everyone.

I have a MSchart control in my webform called Chart1 which is part of the namespace:  System.Web.UI.DataVisualization.Charting.Chart 

I am developing a multi-user (simultaneous connection) to a webform that manipulates controls and displays data on the graph.  Anyhow, I am immediately calling the Chart by using the reference: Chart1.Series.etc.etc.  or Chart1.Series.Addpoints. etc.etc.

My main question is, do I need to do a System.Web.UI.DataVisualization.Charting.Chart Chart1 = new System.Web.UI.DataVisualization.Charting.Chart();  inside  my page_load so that each user gets their own object instance of the Chart1 object?

So that way, if a second user changes the XY data, while the first user just changes the axis, then when the first user re-loads the updated graph, he does not get wrong data (overwritten) by the second user during a cross-session usage?

So must I create an object instance for all users for the MSchart control?


Odd issue with createuserwizard--can't see controls I add to template in code behind in .net 4.0


I was able to customize the createuserwizard in .net 3.5 with no problems.  I could add controls like the dropdownlist for city and state.  In the code behind, I was able to reference these controls by name, such as ddlstate.  However, I'm creating a new site from the ground up in .net 4.0 and was trying to edit the website that visual web developer 2010 creates when you create a new web site.  I went to the register.aspx page and added the city and state dropdowns.  In the code behind, I can't reference them as ddlstate anymore.  I even tried setting the clientidmode to static at the page level since I know the control names get mangled but that didn't help either.  However, the project builds fine as long as I don't attempt to reference the dropdownlist by name in the code behind. 

I'm also using jquery that I pulled from a working .net 3.5 site I had that gets errors when trying to reference the dropdownlist by name in .net 4.0.  The error says "ddlstate" is not a member of "asp.account_register_aspx".  The dropdownlist is set to runat server so I'm really confused why both my jquery and code behind can't seem to see the control in the createuserwizard control.  If I move the dropdownlist outside of the createuserwizard, it can see it and use it just fine.  A

how will take the html controls value from source code to code behind of asp.net page


i created a calendar user control in asp.net+c#.it have two html text boxes and one img button.but i dont know ,how will take
the values to code behind of asp.net from html text boxes values at runtime on the onclick of html img button.....Any ideas????.

This is my main code


      <div>View from:</div>
         <div>  <input type="text" name="showdia" id="showdia" size="9" value="10/04/2010"><input onclick="return showCalendar('showdia', 'mm/dd/yyyy');"  type="image" src="images/cal.gif" align="absmiddle" name="reset" style="cursor:pointer"></div> 
         <div>  <input type="text" name="showdiafin" id="showdiafin" size="9" value="10/04/2010"><input onclick="return showCalendar('showdiafin', 'mm/dd/yyyy');" type="image" src="images/cal.gif" name="reset" style="cursor:pointer" align="absmiddle"></div>
    <div align="center" style="padding:3px;"> <img src="images/language/english/view.g

Code behind file controls not defined/recognized when using WSPbuilder in Visual Studio 08


I am in the process of adding my custom aspx pages to the LAYOUTS folder(a folder I created) in a WSPbuilder solution in VS08. The problem I am having is when I build the solution it fails because the controls(Load, Textboxes, dropdown lists,etc) in the code behind file for the custom aspx pages say they are not defined. They all have a blue squiggly line and I get over 100 errors. Does anyone know what to do to get the WSP to recognize the code behind pages. Is there a setting or something I am missing.

User Controls : load and access properties from code behind



I created a User Control :

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UCSousMenuPrincipal.ascx.cs"
    Inherits="view_usercontrols_UCSousMenuPrincipal" %>
<asp:DataList ID="dataListSousMenuPrincipal" runat="server" RepeatDirection="Horizontal" >
        <asp:HyperLink ID="HyperLink1" runat="server"><%# Container.DataItem %></asp:HyperLink>

to which I added a property, so I can bind the DataList :

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

public partial class view_usercontrols_UCSousMenuPrincipal : System.Web.UI.UserControl
    //Private Member    
    private object dataSource = null;
    protected void Page_Load(object sender, EventArgs e)

Code behind for controls created in Designer



I have a list, which has 2 columns created through the list. I used the SharePoint designer and added 3 asp.net controls to the page. I used the New from existing page, added the controls, saved the new page under the supporting files. When I click on the New item through the site, I am able to the see the newly created controls.

How to use server side (code behind) for the newly created asp.net controls. I have added a dropdownlist and 2 textboxes. I do not want to write Inline code. I would like to use the SelectedIndexchange event for the dropdownlist and Ontextchange event for the textbox.

How to create c# code behind files for the controls created in designer.

Thank you

How can I make controls inside a Template visible to Code-behind


I have created a custom control that implements Templates (based on Panel controls) ... I can do a FindControl to locate imbedded controls.  This allows me to get and set values in the imbedded controls, but I want to be able to reference the imbedded controls like they are properties of the associated panel.  Here is a sample of how my custom control now works:

<cc:CustomControl ID="myCustomControl" runat="server">
<asp:TextBox ID="myTextBox" runat="server"></asp:TextBox>

I can do the following (where my custom control has given the panel hosting the template the name "myPanel"):

Dim txt As TextBox = myCustomControl.myPanel.FindControl("myTextBox")
txt.Text = "Some text to put in TextBox"

What I want to do is:

myCustomControl.myPanel.myTextBox.Text = "Some text to put in TextBox"

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend