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


Top 5 Contributors of the Month
david stephan
Post New Web Links

How to use a custom server control that is defined in inline code in the same page?

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net
 

Hi,

 

I have to use inline code for an aspx page and I need to use a custom server control that is defined in the same aspx page but the control does not get processed as a server control. it gets  returned as is as static html tag.

 

does anyone know how to do that?

 

Thanks,

 

Alaeddin




View Complete Post


More Related Resource Links

Page Life Cycle and custom composite server control life cycle

  

Hi,

We are creating a composite server control. It will have few other controls. I am confused where exactly to write the code ie in which event. Is page life cycle and control life cycle follow the same event order?

Could any one please suggest or post articles on this.

Thank You


Use custom server control in code behind

  

Hi, I developed a custom PeopleEditor control and want to use it in an application page which serves as a task edit form to my workflow. I know that when I declare a variable in the code behind with the same name as control in aspx file, asp.net creates an instance of that control (and binds it somehow), so I can work with methods and properties of that control in my code behind. However, this technique does not work with my custom control. If anybody has an idea of what may be wrong with this, I would appriciate.

Thanks in advance


Zarko

video tutorial link for composite and rendered custom server control

  

hii all

i am new to technology so go easy on this post

according to what i read from web there are 3 type of custom server controls

1 superclass

2 composite

3 rendered

i found video tutorial for superclass custom server control but couldnt find video tutials for other 2.

please forward me link for composite and rendered custom server controls video tutorial  


image inside custom server control

  

Hi,

I want to use an image inside a Custom Web server control ! 

Do I need to use Web.resources ? if so , how to do ?


Custom Server Control Property not maintaining state

  

I have created a server control consisting of a TextArea and a div under it.  My goal is to create my own asp:TextArea type control.  the div is for a Character count of the text area and seems to work ok but i added a CharacterCountVisible property to the control that is always returning true.  See Proptery definition below

 

<Bindable(False), Category("Appearance"), DefaultValue("True"), Localizable(True)> Property CharacterCountVisible() As Boolean
    Get
        Return _CountBoxVisible
    End Get
    Set(ByVal value As Boolean)
        _CountBoxVisible = value
    End Set
End Property

Note the _CountBoxVisible variable is define inside the class as :

Dim _CountBoxVisible as Boolean = True

What I am trying to do is give the user/coder the option to show/utilize the char count feature.  Can make it disappear with textarea1.CharacterCountVisible = False but setting it to true will not make it display.

 

What am i missing

 

Thanks

 

 


Sign outgoing body from client with custom endpoing behavior defined in code

  
I'm trying to sign (and sign only) the body of every outgoing message that uses this custom endpoint behavior.  When I first created this it was for signing a custom SOAP header.  We are moving away from that and going to just sign the body.  We have some applications that have 10+ web service references.  We don't want to touch the reference.cs for anything.  Below is the code I had before for signing the custom soap header.  I'm trying to modify it to just sign the body.  My modified code is below, and the error I get. Private Class CustomHeaderBehavior Implements ServiceModel.Description.IEndpointBehavior Public Sub New() End Sub Private Sub AddBindingParameters( _ ByVal endpoint As ServiceModel.Description.ServiceEndpoint, _ ByVal bindingParameters As ServiceModel.Channels.BindingParameterCollection) _ Implements ServiceModel.Description.IEndpointBehavior.AddBindingParameters Dim body As New Xml.XmlQualifiedName("Body", "http://schemas.xmlsoap.org/soap/envelope/") Dim BodyMsgPartSpec As New ServiceModel.Security.MessagePartSpecification() BodyMsgPartSpec.IsBodyIncluded = True Dim requirements As ServiceModel.Security.ChannelProtectionRequirements = bindingParameters.Remove(Of ServiceModel.Security.ChannelProtectionRequirements)() requirements

custom server control with custom child collection,get the collection?

  
Hi!I want to create a custom server control, that then will have a custom child collection.The thing is that I also want to be able to modify the custom childs from the custom server control classFor example I have a row of cards, and the class is called CardRow, a CardRow is simply a class full of the class card in this case, se the class "Card" down below:using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections.Generic; namespace MemoryLib { [ToolboxData("<{0}:CardRow runat=server></{0}:CardRow>")] public class CardRow : WebControl { public List<Card> _Card; [PersistenceMode(PersistenceMode.InnerProperty)] public List<Card> Card { get { return _Card; } set { _Card = value; } } public CardRow() { } protected override void CreateChildControls() { } protected override void Render(HtmlTextWriter writer) { } } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace MemoryLib

Adding a custom control to the SharePoint 2010 Team Site Wiki Page Template ( wkpstd.aspx ) programm

  
Topic This is maybe my last post about the Team Site Wiki Page customization with the aim of exceeding its limitations. This time we are going to customize the unique template ( wkpstd.aspx) by replacing the control that renders the editable content by a custom one. In this post example, we will take advantage of the use of this custom control to render not editable additional contents, for instance, a header and a footer that could be the same for a specific Wiki Page Library. Of course, we are not going to really customize the template, but we are going to use a delegate control to replace the control at runtime. Here are the screen shots of the result: We can see a non editable Header and Footer on the Team Site Wiki Page In edit mode these additional contents are not rendered, but we can add new content as usual And of course, after having saved the page, the new content is rendered wtih the non editable Header and Footer. Steps required   If you look at the Team Site Wiki Page template, wkpstd.aspx, you can see the control that is rendering the editable content/ <SharePoint:EmbeddedFormField ID="WikiField" FieldName="WikiField" ControlMode="Display" runat="server" /> We are first going to create a custom EmbeddedFormField control Then, we are going to use a delegate control to replace the native EmbeddedFor

How to embed jquery library in ASP.NET Custom Server Control

  
i created custom server control using jquery. i  embeded  jquery library in the control using following code. but it displays object expected error.  has someone done this before ?   //other code    protected override void RenderContents(HtmlTextWriter output) {    output.Write("<div id=\"bckPopup\"></div>"); }   protected void onInit(EventArgs e) { Page.ClientScript.RegisterClientScriptResource(GetType(), "HelpServerControl.Scripts.jquery-1.4.1.min.js");   string javascript = "<script type='text/javascript'> " +   "$(document).ready(function () { " +   "$('#bckPopup').text(\"loaded\"); " + "});</script>" ;   if (!(Page.ClientScript.IsClientScriptBlockRegistered("bhelp" ))) Page.ClientScript.RegisterStartupScript(this.GetType(), "bhelp" , javascript); base .OnInit(e);   }      

Is there a way in VB.Net to embed a custom user control to a web page based on Word or Excel

  
Hi Everyone.  I'm looking to create a web page that would be used on a local intranet that would use a custom control based on Word and Excel.  I've used code previously to embed it in a Windows application but wasn't sure if anyone knew of any examples out there on how to embed a custom control into a ASP.Net page.

Automatically inserting server-side page events into C# when using code separation

  
I know this is a really basic question and I have spent the last half hour trying to find an answer so please forgive me if this has been asked before (it probably has)....When I create a web page with the C# code placed in a separate file I can't seem to easily add page events (apart from Page_Load). When I open the C# class code for the page all I see in the two drop-down boxes above the code is "Default" (with no other options in the drop-down) in the left-hand box and "ApplicationInstance,form1,Page_Load(object sender,EventArgs e),Profile" in the right hand box. I can't see a way to create the code for the other page events from either of these drop-downs.If I keep the C# code in the same file (i.e., not use code separation) everything works fine - I see "Server Objects & Events, Page, Form1, etc..." in the left hand drop-down and I can create new events in the right drop-down when either Page or Form1 are selected in the left box.Am I missing something really obvious?Many thanks for any suggestions

Dynamic ModalPopupExtender within a Custom server control

  
Hi folks,   I have this piece of code which paint an ImageButton and show a dynamic ModalPopupExtender (with 2 buttons btnGuardar and btCancel). The issue is neither btGuardar.Click nor btHidden.Click events are raised but ImageButton Click event is raised correctly. Please can you help mee?  protected HtmlGenericControl _divControlContainer = new HtmlGenericControl(); protected ModalPopupExtender _PopupHandler = new ModalPopupExtender(); protected override void CreateChildControls() { Page.Trace.Write("void CreateChildControls()"); _divControlContainer = new HtmlGenericControl("ivContenedor"); Button btHidden = new Button(); btHidden.ID = "hiddenTargetControlForModalPopup"; btHidden.Style.Add(HtmlTextWriterStyle.Display, "none"); btHidden.Click += new EventHandler(event_HiddenTargetModalPopup_Click); //EVENT NOT RISED _divControlContainer.Controls.Add(btHidden); ImageButton ib = new ImageButton(); ib.ID = "btUploadImage"; ib.ImageUrl = "~/Imagenes/UIControlImageViewer/upload.png"; ib.Height = new Unit("16px"); ib.Width = new Unit("16px"); ib.Click += new ImageClickEventHandler(event_UploadFile_Click); //EVENT RAISED CORRECTLY _divControlContainer.Controls.Add(ib);

How to submit data to a SQL Server database table from a custom page ?

  
Using SPD, I have created a custom page. It has a form with ASP.NET controls textbox, radio buttons, dropdown, submit button etc., Also, I created a Database connection (to the SQLServer database table) under Database Connections. But not sure how to connect this form to the database connection so that when form data is submitted, the data will be inserted into the table.

unable to trace value after postback within Custom Server Control

  
public class TextBox : AStateManagement, IControl { #region "Variables" #region "Local Variables" protected System.Web.UI.WebControls.WebControl _TextBox = null; protected string _CssClass = string.Empty; protected string _Text = string.Empty; protected bool _Visible = true; protected bool _Enabled = true; protected string _ID = string.Empty; protected bool _IsViewStateLoaded = false; #endregion "Local Variables" #region "Global Variables" #endregion "Global Variables" #endregion "Variable" #region "Constructor" public TextBox() { _TextBox = new System.Web.UI.WebControls.TextBox(); _TextBox.ID = this.UniqueID; } #endregion "Constructor" #region "Events" #endregion "Events" #region "Disposable" #endregion "Disposable" #region "Properties" public override string CssClass { get { return _CssClass; } set { _TextBox.CssClass = _CssClass = value; } } public virtual string Text { get { return _Text; }

find control in datalist by javascript(Not by Code Behind CS Page or ItemDatabound)

  

Hello all,

I am facing a problem with javascript.Following is the scenario:

I am working on survey application......

I have taken a datalist in which the question in survey are bound in a label control

now user can change color of the question using color picker

color picker have a popup which is closed when user selects a color and

the color of question will be updated as popup closes

So i have to find label control(in which i bound questions)

in datalist by javascript only (not by Cs page or by itemdatabound event because of color picker popup i can not use cs page)

and update the color of label selected by color picker


I googled and found following code but it show null value

var lbl = document.getElementById('<%= Page.Master.FindControl("ContentPlaceHolder1").FindControl("dList").FindControl("lblQuestion") %>');

when I saw the page source following id is generated for label

ctl00_ContentPlaceHolder1_dList_ctl00_lblQuestion
ctl00_ContentPlaceHolder1_dList_ctl01_lblQuestion
and so on


D

Custom server control Books and URLs

  

Hi all,
      I am new to custom server control. I want to create my own grid like custom server control for my project. Please suggest me some good books and urls.

Thanks


ConfirmButtonExtender and ModalPopupExtender Server Control with Master Page Failed to find element

  

I am in the process of building a server control that contains a ConfirmButtonExtender. This is my code:


The Master Page:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="CBC_MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
       
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

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