|
Write a Logger class and a static method to store log details.
In the business layer, you can call this method when exception occurs(inside catch block)
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
you can do as same as you do when you are adding new records to database.
Or. maybe you may try to use Enterprise Logging Library or log4net library..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
can you give me one example
|
|
|
|
|
Take a look at this: log4net. A google search on 'getting started with log4net' will give you plenty of examples. It also means you can safely ship your code with debug statements still in.
|
|
|
|
|
Manual logging.
public bool SaveSomething(string something){
try{
using (SqlConnection connection = new SqlConnection(
connectionString)){
SqlCommand command = new SqlCommand("INSERT INTO Table1 VALUES('" + something + "'", connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
catch(Exception ex){
LogError(ex.Message)
}
}
public void LogError(string msg){
using (SqlConnection connection = new SqlConnection(
connectionString)){
SqlCommand command = new SqlCommand("INSERT INTO LogTable VALUES('" + msg + "'", connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
If you wanna know how to use "log4net" or "Enterprise Logging Library", please google with these keywords "log4net sample" or "Enterprise Logging". cuz it's not that easy to post a lot of code here..
hope, it would help..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
Hi,
I have created region using graphic in VB.net and assign that region as button.region = region.
my code as,
Dim polyPath As New GraphicsPath(FillMode.Winding)
Dim pts() As Point = { new point(0,0), new point (50,0), new point(50,50), new point(0,50)}
polyPath.AddPolygon(pts)
Dim rotation_matrix As New Matrix
rotation_matrix.RotateAt(0, New PointF(25, 25))
'Transform the GraphicsPath.
polyPath.Transform(rotation_matrix)
Dim polygon_region As Region
polygon_region = New Region(polyPath)
button1.region = polygon_region
This works fine in vb.net, thru this i can able to create new square shape in button control. I want to reuse this code in ASP.net. Any help on this.
Thanks in advance.
Be simple and Be sample.
|
|
|
|
|
Asp.net is a different technology. Every time the page loading the dll rendered an html page. So this code won’t work in asp.net. Actually what is your requirement?
Thomas
|
|
|
|
|
Hi,
I want to create different shapes and show it in web form dynamically. I did the same in vb.net to create shape as region and assign to button.region.
Thanks.
Be simple and Be sample.
|
|
|
|
|
You can use flash objects, animated gif, images, CSS or JavaScript animation instead of that.
Thomas
|
|
|
|
|
A web page is simply a text document of HTML markup, this is what ASP.NET sends to client, it is completely different from a WinForms application. There is no such thing as a 'shape', just buttons, text boxes, divs, spans etc.
|
|
|
|
|
hello all
i m developing a website. it is runing properly on www.but i hav to use a ajax control into a particular page and tht gives me following error
Ambiguous match found.
so anyone help me abut this error.
best regards
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Hi Deepak,
I searched this in google site.
Are you using VB.Net as code behind language?
Then it seems like you have two variables in your page that differ only in the
case. For example, in your aspx page, you might have
<asp:textbox id="UserID" runat="server">
and in the code behind file you might have
private Int32 userID = 0;
Double check your code.
Harini
|
|
|
|
|
hi harini
tnx a lot buddy i appreciate u.
i m using C# in VS2005
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
The most common senario about Ambiguous match found when you declared a variable for a specific datatype like the XML which exist in two different namespace. This was common when the type of project you have is WEB because by default the two namespace for XML are referenced, System.Web.UI.WebControls.Xml And System.XML
This code will generate Ambiguous match found.
*VB <br />
Dim myXML AS XmlDocument = New XmlDocument()<br />
<br />
*C#<br />
XmlDocument myXML = new XmlDocument();
Be more specific in namespace to prevent Ambiguous error.
*VB <br />
Dim myXML AS System.Xml.XmlDocument = New System.Xml.XmlDocument()<br />
<br />
*C#<br />
System.Xml.XmlDocument myXML = new System.Xml.XmlDocument();
OR
*VB <br />
Dim myXML AS WebControls.Xml.XmlDocument = New WebControls.Xml.XmlDocument()<br />
<br />
*C#<br />
WebControls.Xml.XmlDocument myXML = new WebControls.Xml.XmlDocument();
|
|
|
|
|
Hi friends
I am using master page in asp.net with c#.
I have one script file as join.js.
now i want to know how do it call in content page on button click events?
thanks in advance.
Pathan
|
|
|
|
|
just link ur js file from master page.
Then, you can invoke the function of that js file from your content page as usual.
Hope it helps..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
place this code to yourmaster.master header section
<header>
...
...
<script language src="~/Script/join.js"></script>
</header>
then add attribute onclientclick to button.
<asp:Button id="mybutton" Onclick="MyServerSideMethod" OnClientClick="MyJavaScriptFunction();" Text="Click Me" runat="server"></asp:Button>
regards,
Mark
-- modified at 0:22 Friday 23rd February, 2007
|
|
|
|
|
|
Can you post your masterpage and Page code? This will help us to solve your problem.
regards,
Mark
|
|
|
|
|
i write below code in header tag of master page
<script language="javascript" src="script/login.js" type="text/javascript">
</script>
.js file is in script folder.
my content page and master page both r located at top of directory.
i call it by doing this code as u gave me.
<asp:Button ID="BT_signin" runat="server" CssClass="text1" Height="24px" Text="Sign In"
Width="52px" OnClick="BT_signin_Click" OnClientClick="login();" />
Thanks
Pathan
|
|
|
|
|
try to replace your script src attribute.
OLD
<script language="javascript" src="script/login.js" type="text/javascript"><br />
</script>
NEW
<script language="javascript" src="~/script/login.js" type="text/javascript"><br />
</script>
the symbol "~" means root directory.
can you describe what the client function login does?
If doesn’t work please post the exact error.
Regards,
Mark
|
|
|
|
|
this is my function login
function login()<br />
{<br />
if(document.getElementById('TB_uname').value=="")<br />
{<br />
alert('Enter Your Username');<br />
return false;<br />
}<br />
}
Yeah.still It doesn't work.It doesn't give any error message.
thanks
|
|
|
|
|
Now i know what is your real problem you want to prevent the postback if the TB_uname is equal to empty string. the problem is in your onClientClick attribute you need to add "return".
OnClientClick="return OnClientClick="login();"
Change your login function to this code.
function login()
{
if(document.getElementById('TB_uname').value=="")
{
alert('Enter Your Username');
return false;
}
else
{
return true;
}
}
And Your Button
<asp:Button ID="BT_signin" runat="server" CssClass="text1" Height="24px" Text="Sign In" Width="52px" OnClick="BT_signin_Click" OnClientClick="return login();" />
Keep me updated...
Regards,
Mark
|
|
|
|
|
And tell me if you have a javascript error? if does it means the join.js is not yet visible to your page.
Keep me updated.
Regards,
Mark
|
|
|
|
|
If I write simple alert message then its fire.but when I write it in if condition then its not fired.
I think my texbox's id is not found in .js file.
|
|
|
|