TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sam caleb
NA
39
0
Problem in Web Control Library
Feb 18 2009 11:07 PM
Hi Friend's ...
M new to c#.net, I have created a web control library and made to dll file but when i invoked in a web project and drag and draw that control is invisible here is that code can anyone explain me how to use that and where i have made error .....
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
namespace samLibray
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl
{
public TextBox t1 = new TextBox();
public Button b1 = new Button();
public Label l1 = new Label();
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
output.Write(Text);
}
protected override void CreateChildControls()
{
l1.ID = "l1sam";
l1.BorderColor = System.Drawing.Color.Chocolate;
l1.Visible = true;
Controls.Add(l1);
Controls.Add(new LiteralControl("<Br>"));
t1.ID = "t1sam";
t1.ForeColor = System.Drawing.Color.Azure;
t1.Visible = true;
Controls.Add(t1);
RequiredFieldValidator rf = new RequiredFieldValidator();
rf.ID = "rfsam";
rf.ErrorMessage = "Values Needed";
rf.ControlToValidate ="t1sam";
rf.Visible = true;
Controls.Add(rf);
Controls.Add(new LiteralControl("<br>"));
b1.ID = "b1sam";
b1.ForeColor = System.Drawing.Color.Blue;
//buttonCell.Width = Unit.Pixel(1);
b1.Width = Unit.Pixel(1);
b1.Visible = true;
Controls.Add(b1);
Controls.Add(new LiteralControl("<br>"));
EnsureChildControls();
}
protected override void OnInit(EventArgs e)
{
l1.Text = "Enter Data";
b1.Text = "Submit";
base.OnInit(e);
}
private void b1sam_Click(object sender, EventArgs e)
{
}
}
}
Tks in Adv...
G.sam...
Reply
Answers (
13
)
Form1.Visible = false equivelent in C#.NET 2.0
The process cannot access the file because it is being used by another process