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


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Weird effect on control rendering

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :WPF
 

 

 

Sometimes this:

 

is how my window is rendered, while it should look be like this:

Any ideas on why is this happening?




View Complete Post


More Related Resource Links

Rendering User Control content

  

I have a scenario where, the content is:
<div>
 ASP.NET Controls
      User Control
 ASP.NET Controls
</div>

The entire div code is rendered and is sent at a mail using the code:

Dim sw As New StringWriter()
Dim w As New HtmlTextWriter(sw)
Dim s As String = sw.GetStringBuilder().ToString()
dvContent.RenderControl(w)


This works fine except that the User Control does not get rendered.

Any way out, so that the User Control content is also rendered ?


Menu control rendering issue with IE8

  

Hi

Using VS2010, I created an ASP.NET 4.0 web application and simply added a couple of menu items below the "Home" menu item in the master page that's created by the project wizard. I made no other changes - no code, no stylesheet changes.

If I run the app locally then everything is fine. I suspect because the local IIS is responsive enough for the problem not to occur.

If I deploy the app to a web host (discountasp.net) then I see the menu render vertically for less than a second before it renders correctly. If I refresh the page a few times then usually I can see the menu vertical flash but sometimes I can't, so there's some sort of timing consideration.

I'm using IE8. The problem doesn't seem to occur with either Firefox 3 or Chrome.

Have others seen this problem?

Any suggestions for a fix?

I can supply the zipped up project if anyone wants it.

Thanks


Can't get ClientID of ASP control in Rendering template

  
Hi, I've made custom field with its own rendering template. Inside template i need to show/hide some controls, but i cant get ClientID of them. Inside rendering template : <%@ Assembly Name="XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=72277ea422a3515d" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Control Language="C#" AutoEventWireup="true&q

weird Rating Control behavior

  
Hi folks! :)I have Rating control on my page. The page is a subpage of nested master page. On that page is updatepanel and wizard with TemplatedWizardStep inside it and inside TemplatedWizardStep is Rating Control.Master.Page -> NestedMaster.Page -> Content.PageI allso have googlemap inside that wizard(on different step) so i need to register google initialize() for it to work.So by registering googlemap like example below Rating Control freezes. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "initialize()", True) End Sub But if i include script tags in string like example below, Rating Control does not freeze. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "<script>initialize()</script>", False) End Sub Everythnig works, but i wonder, WHY :) Why is Rating Control freezing in sample1?

Object Reference Error While Rendering Menu Control

  

I am having a problem with rendering a menu control inside a server control. I am getting an error in the RenderContents override method when I try to render the Menu Control. The error I am getting is an Object Reference error. The code is below...

[ToolboxData("<{0}:Login runat=server></{0}:Login>")]
    public class Login : CompositeControl
    {
        #region Members

        Label tst;
        Menu loginMenu;
        MenuItem mainLoginItem;
        MenuItem loginItem;
        MenuItem usernameItem;
        MenuItem passwordItem;
        SubMenuStyle subMnuStyleControl;
        SubMenuStyle subMnuStyleMenu;

        bool isLoggedIn = false;

        #endregion

        #region Properties

        public bool IsLoggedIn
        {
            get { return isLoggedIn; }

            set { isLoggedIn = value; }
        }

        #endregion

        #region Overridden Events

        protected override void RenderContents(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            loginMenu.RenderControl(writer);

        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            CreateChildControls();
            ControlSetup();

            #region Add CSS references
            string cssUrl = Page.ClientScript.GetWebResourceUrl(this.Ge

error rendering control

  

Hi, I am working with VS 2008, I created a usercontrol to select dates, when I put It into my web pages inside an UpdatePanel and all seem to be ok, but suddenly I got the Error Rendering Control, I don´t understand it?  


Rendering A Menu Control To A String

  

 Hi all,
coud someone please tell me why the following code bombs with a NullReference exception.

        Dim m As New Menu
        Dim mi As New MenuItem("First")
        Dim sb As New StringBuilder
        Dim html As String
        m.Items.Add(mi)
        Using sw As StringWriter = New StringWriter(sb)
            Using tw As HtmlTextWriter = New HtmlTextWriter(sw)
                m.RenderControl(tw)
            End Using
        End Using
        html = sb.ToString

I just want to output the html for the menu control to a string, if I remove the line that adds the new menu item or I change the control to a calander control instead of a menu control the it works fine.


Error rendering control

  

Hi there,

Environment:

VS2010, XP


Problem:

I am getting an error message "An unhandled exception has occurred. Object reference not set to an instance of an object." in

Design mode for my new server control which I write for testing and learning purposes.


If I run the page the control does what it expected to.


Any idea ?


rendering a CheckBox web control from Oracle NVARCHAR2 (1) data column

  

I have a data column in Oracle as NULLABLE NVARCHAR2 (1) which accepts Y for True or N for False and nulls. 

When I have Dynamic Data to render this column, it renders it as a TextBox web control.

Is there a way to make Dynamic Data to render it as a CheckBox web control?

Thanks,


Can SharePoint field control have update panel inside a rendering template?

  

I am creating a custom field control with the following rendering template

<

 

SharePoint:RenderingTemplate Id="TestFieldRendering" runat="server">

 

styled combobox item rendering issue while display over another control

  

i have combobox with a custom style bind to an enumeration. and below that there is a text box. when i select the combo box value the list doesn't disappear, 

 

the style to the combobox is as follows 

 

<Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

                    <Grid Background="{TemplateBinding Background}">

&n

styled combobox item rendering issue while display over another control

  

i have combobox with a custom style bind to an enumeration. and below that there is a text box. when i select the combo box value the list doesn't disappear, 

 

the style to the combobox is as follows 

 

<Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

                    <Grid Background="{TemplateBinding Background}">

&n

styled combobox item rendering issue while display over another control

  

i have combobox with a custom style bind to an enumeration. and below that there is a text box. when i select the combo box value the list doesn't disappear, 

 

the style to the combobox is as follows 

 

<Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

                    <Grid Background="{TemplateBinding Background}">

&n

styled combobox item rendering issue while display over another control

  

i have combobox with a custom style bind to an enumeration. and below that there is a text box. when i select the combo box value the list doesn't disappear, 

 

the style to the combobox is as follows 

 

<Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

                    <Grid Background="{TemplateBinding Background}">

&n

Rendering web user control problem in design view

  
Hi friends.
 
i used some code from a site as below, which extends ASP.NET Menu Server Control,
mymenu renders as expected in browser but it renders in desinger as Ordinary Menu.
my question is how to override this behaviour to render in desgin view as in browser?
 
mymenu class:
using System;
using System.ComponentModel;
using System.Security;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;



namespace CustomConrols
{
    [
    AspNetHostingPermission(SecurityAction.Demand,
           Level = AspNetHostingPermissionLevel.Minimal),
       AspNetHostingPermission(SecurityAction.InheritanceDemand,
           Level = AspNetHostingPermissionLevel.Minimal),
       DefaultProperty("MenuTitle"),
       ParseChildren(true, "MenuTitle"),
       ToolboxData("<{0}:MyMenu runat=\"server\"> </{0}:MailLink>")]
    public class mymenu: Menu
    {


        private string menuTitle = "Menu";
        [
       Bindable(true)

Details View - Change control rendering

  

Hi

i am currently using the CSSFriendly adapters and need to change their behavours.  I am currently using a detailsview control to generate a form based upon a table in a DB and that the detailsview generates the column automatically.

If a column in the DB is of type bool the adapter displays a check box but for all other types it displays a text box.  I want to be able to customize this and actually have some rendered as dropdowns.  Is this possible by updating the adapter?



Change location of a control in C# , it works fine in XP but in window 7 it donot take proper effect

  

I have created many custom control in my application. In these controls I make some text boxes  visible and invisible and change their locations according to my requirement. These controls work fine when I run application in window XP but when I run this application in windows 7, text boxes don't appear on proper locations and often overlap each other.

Please help me


Categories: 
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