Remove app.config from ClassLibrary.
Make the Setting you have done say EntLib Blocks-Logging and ExceptionHandling etc on the config file
of WCF Service or Application in which you are using the reference of class library.
It resolves your error..
Happy Coding,Hurray !
Friday, July 2, 2010
Friday, December 4, 2009
Code to Add Controls dynamically to Form
for (int k = 0; k < 5; k++)
{
TextBox t = new TextBox();
this.form1.Controls.Add(t);
LiteralControl l = new LiteralControl("<br/>");
this.form1.Controls.Add(l);
}
Note:We have taken the help of literal controls to place a TextBox in NextLine.
Here we are generating 5 TextBoxes.
PlaceHolder PlaceHolder1 = new PlaceHolder();for (int i=1; i<=10; i++)
{Label lbl = new Label();
lbl.Text = "Label" + i.ToString();
lbl.ID = "Label" + i.ToString();
PlaceHolder1.Controls.Add(lbl);
PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));}
Here we are adding 10 Labels.
Labels:
add controls form
Monday, November 16, 2009
sys is undefined
The reason for this error is your web.config does not contain all the settings required for an ajax enabled web site.
First , generate an ajax enabled web site namely ajaxsite1 and compare your web.config with that of ajaxsite1.
you observe that code in httpHandlers is not there in your website or it might be improper.
Replace the web.config code in ajaxsite1 in to your website.
See that after running you will ge 'Done' at the bottom left.Previously you get 'Done with Errors' message in this portion.
Note:
All this errors and exceptions generally occur if you are working with Ajax Controls.You will not get your ajax controls functionality in your webpage unless you clear all these script errors.
Some of the controls that may raise this error are AutoComplete,CalendarExtendar etc
First , generate an ajax enabled web site namely ajaxsite1 and compare your web.config with that of ajaxsite1.
you observe that code in httpHandlers is not there in your website or it might be improper.
Replace the web.config code in ajaxsite1 in to your website.
See that after running you will ge 'Done' at the bottom left.Previously you get 'Done with Errors' message in this portion.
Note:
All this errors and exceptions generally occur if you are working with Ajax Controls.You will not get your ajax controls functionality in your webpage unless you clear all these script errors.
Some of the controls that may raise this error are AutoComplete,CalendarExtendar etc
Tuesday, November 10, 2009
Reset DropDownList to Default Value
Use following lines:
DropDownList1.SelectedIndex = 0;
or
DropDownList1.ClearSelection();
DropDownList1.Items.FindByText("--Select--").Selected = true;
or
DropDownList1.ClearSelection();
DropDownList1.Items.FindByValue("--Select--").Selected = true;
Note:
We need to mention DropDownList1.ClearSelection(); before using DropDownList1.Items.FindByValue("--Select--").Selected = true
(or)DropDownList1.Items.FindByText("--Select--").Selected = true
Otherwise you will get an error 'Cannot have multiple items selected in a DropDownList'
DropDownList1.SelectedIndex = 0;
or
DropDownList1.ClearSelection();
DropDownList1.Items.FindByText("--Select--").Selected = true;
or
DropDownList1.ClearSelection();
DropDownList1.Items.FindByValue("--Select--").Selected = true;
Note:
We need to mention DropDownList1.ClearSelection(); before using DropDownList1.Items.FindByValue("--Select--").Selected = true
(or)DropDownList1.Items.FindByText("--Select--").Selected = true
Otherwise you will get an error 'Cannot have multiple items selected in a DropDownList'
Wednesday, November 4, 2009
How to access asp.net server controls usingJavaScript?
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox1" runat="server">
<div>
<asp:textbox id="TextBox1" runat="server">
document.getElementById('<%=TextBox1.ClientID%>').value;
ClientID - server control identifier generated by ASP.NETdocument.forms[0]['TextBox1'].value;
Subscribe to:
Posts (Atom)
