Saturday, August 18, 2012

Discipline

I learned that greatest things in life will never happen with out discipline.
Passion may drive us but up to 50 %
It is discipline that keeps us on top consistently.

Sunday, August 1, 2010

Hide a Button using JavaScript

Suppose there is a ASP.NET button with ID=btnSubmit..You want to make it invisible on the okclick event of an anchor tag :


write the below function in javascript :

function F1()
    {
    alert('ravi')
    document.getElementById("btnSubmit").style.visibility="hidden"
    }

Friday, July 2, 2010

Unable to host WCF Service in remote machine and Use it

You see WCF service works fine  if you use it in the application which resides in the same machine as that of
WCF service.But if you try to host the WCF service in remote machine and use it from your application,you can not add service reference even though you have given correct reference url..

Change Binding to basicHttpBinding from WsHttpBinding. of your WCF Service and rebuild.
Then add a reference to the service which is hosted in your local machine--say http:\\youripaddress\MyService\Service1.svc to the application.
Change the endpoint address

 < endpoint address="http://192.168.160.58/MyService/Service1.svc"              
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDALService"
                contract="CRSService.IDALService" name="BasicHttpBinding_IDALService" />

This solves your problem.

The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, DB Wrap Policy]) failed: Object reference not set to an instance of an object. (Strategy type ConfiguredObjectStrategy, index 2)

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, December 4, 2009

Code to Add Controls dynamically to Form

for (int k = 0; k &lt; 5; k++)

{

TextBox t = new TextBox();

this.form1.Controls.Add(t);

LiteralControl l = new LiteralControl("&lt;br/&gt;");

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.