|
This isn't a WCF client.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Ok, you can use the same general approach but store the service location in a config file and dynamically assign it at runtime, an example is here (it's in VB but you'll get the gist):
Example[^]
|
|
|
|
|
I am using ASP.Net with C#, framework 3.5.
I am working on a page that uses a "Next" button on a master page to inititate a server side click event to do some processing using a session object, and then a Server.Transfer to the next page. The same Master page "Next" button handles all the pages in the app. At some point I am sure that I will need to inroduce a client side click event to do client side validation on one of the pages. What is the best way to do the client side validation and still utilize the server side click event code I already wrote? Or should I abandon my server side click event code and just do everything on the client side?
|
|
|
|
|
Better if you use ASP.NET validators.Have different validation for different page and have a javascript function,pass it with and the validation group and validate the it using page_clientvalidate('groupname') and return false if it fails then your server side event would not fire else return true.It'll continue to postback.
For more info about asp.net validators have a look to one of my article Exploring ASP.NET Validators
|
|
|
|
|
I agree with Brji...
But there may be another way.
I try to stay away from client side JavaScript. It's too hard to debug and test. But you could always have the "Next" button postback and make a decision to continue (Response.Redirect(whatever.aspx) or to not continue based on the entered information. I do it quite frequently, but I come from a WinForms background where I'm used to having fine control over the actions of the user. I think anytime you rely on JavaScript, you will get burned in the long run with compatibility issues anyway.
Ryan
|
|
|
|
|
hey,
I got a problem related with mail server. i tried to send email from asp.net. my code is
MailMessage message = new MailMessage("sm@hotmail.com", "sm@hotmail.com");
message.Subject = "Project Request";
message.Body = "Project named " + txtProjectTitle.Text + "has arrived";
message.Priority = MailPriority.High;
SmtpClient client = new SmtpClient("localhost");
client.Send(message);
But i doubt in the smptclient part. I gave localhost but it is giving error like
<pre lang="msil">System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at ProjectRequestTest._Default.btnSubmit_Click(Object sender, EventArgs e) in C:\Documents and Settings\sm\My Documents\Visual Studio 2008\Projects\ProjectRequestTest\ProjectRequestTest\Default.aspx.cs:line 50</pre>
How to solve it ? or what client name do I have to give and how do I know that name ?
Thanks in advance,
suchi
suchitamanandhar@hotmail.com
|
|
|
|
|
Are you running a smtp service on your pc? Probably not.
In most cases you should use the smtp relay host that your ISP has assigned to you. If you are in a corporate environment, ask you mail administrator which servers to use, and what the the restrictions are.
And last, don't put your email address in your post, if you don't want to get spammed to death with male erectile enhancers, cheap diplomas, and Nigerian dictators who need someone to cart their fortune out of the country.
|
|
|
|
|
hii friends, my line of code is
dv.RowFilter = "Date=" + Convert.ToDateTime(reportdate);
Date is the name of a column in my table and is of type Datetime.
reportdate is a variable of type string.
I am getting this SyntaxErrorException.
Syntax error: Missing operand after '12' operator.
plz help me to solve this error.
Thanks.
|
|
|
|
|
try this
dv.RowFilter = String.Format(CultureInfo.InvariantCulture.DateTimeFormat,
"Date = #{0}#", Convert.ToDateTime(reportdate));
It should work.
|
|
|
|
|
now it is saying like this
Cannot perform '=' operation on System.String and System.DateTime.
|
|
|
|
|
your Date column is of which time? string or Datetime. Both should be same.
And also one more in which format the date is in dataview. Both should be same.Accordingly convert the datetime object.
|
|
|
|
|
the Date column is of datetime type.
reportdate is of type string and contains "01/01/10"
in the dataview the format of Date is as follows
#01/01/2010 00:00:00#
|
|
|
|
|
As I suggested put the use the dataetime objects in same format at both end.
Have a look to this link
|
|
|
|
|
Enclose the date in single quotes
dv.RowFilter = string.Format("Date='{0}'", Convert.ToDateTime(reportdate));
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
now am getting
Error: String was not recognized as a valid DateTime.
dv.RowFilter = string.Format("Date='{0}'", Convert.ToDateTime(reportdate));
the reportdate contains "01/01/10"
and in the dataview the format of date is:
Date='1/1/2010 12:00:00 AM'
is this error because of the date formats? if so how to make them compatible.
|
|
|
|
|
DateTime dt;
if(DateTime.TryParse(reportDate, out dt))
{
dv.RowFilter = string.Format("Date='{0}'", dt);
}
or the overload
if(DateTime.TryParse(reportDate, IFormatProvider, Style, out dt))
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
If you don't care about the time portion use this
<br />
dv.RowFilter = string.Format( "Date='{0}'", reportdate.ToString("dd/MM/yyyy");<br />
|
|
|
|
|
still i could not solve it.
i am getting the following error when i am trying this..
dv.RowFilter = string.Format("Date='{0}'", reportdate.ToString("dd/MM/yyyy"));
The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
|
|
|
|
|
Sorry, I didn't realize that you were using the string value. To use the string, use
<br />
dv.RowFilter = string.Format("Date='{0}'", Convert.ToDateTime(reportdate).ToString("dd/MM/yyyy"));<br />
|
|
|
|
|
hi,
my html look good in IE but it look odd in firefox but i can not understand the reason.i work with checklistbox.so i am giving my html snippet below. please anyone check it and tell me why it is looking bad or cluttered in Firefox.how to make it compatible for all the browser.
html
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="58%" bgColor="#d8e4f8" border="0">
<TR><TD vAlign="top" noWrap width="10%"><span id="Label2" style="font-weight:bold;">Date</span>
<input name="txtDate" type="text" readonly="readonly" id="txtDate" style="border-style:Groove;" /></TD>
<TD vAlign="middle" noWrap width="7%"> <span id="Label3" style="font-weight:bold;">Country</span></TD>
<TD vAlign="top" width="36%"><table id="chkCountry" border="0" style="font-weight:bold;width:100%;">
<tr><td><input id="chkCountry_0" type="checkbox" name="chkCountry " /><label
for="chkCountry_0">UK</label></td><td><input id="chkCountry_1" type="checkbox" name="chkCountry:1" /><label
for="chkCountry_1">USA</label></td><td><input id="chkCountry_2" type="checkbox" name="chkCountry:2" /><label
for="chkCountry_2">Germany</label></td><td><input id="chkCountry_3" type="checkbox" name="chkCountry:3" /><label
for="chkCountry_3">France</label></td><td><input id="chkCountry_4" type="checkbox" name="chkCountry:4" /><label
for="chkCountry_4">Italy</label></td><td><input id="chkCountry_5" type="checkbox" name="chkCountry:5" /><label
for="chkCountry_5">Canada</label></td><td><input id="chkCountry_6" type="checkbox" name="chkCountry:6" /><label
for="chkCountry_6">Netherlands</label></td>
</tr></table></TD><TD vAlign="top" width="5%"><button language="javascript" onclick="setTimeout('javascript:IsBusy(1);',50);
__doPostBack('btnGo','')" id="btnGo" type="button" value="GO"></button></TD>
</TR><TR><TD vAlign="top" noWrap width="10%"></TD><TD vAlign="middle" noWrap width="7%"></TD><TD vAlign="top" align="right" width="36%">
<a id="HyperLink1" href="EODMain.aspx">Main Menu</a></TD><TD vAlign="top" width="5%"></TD></TR></TABLE>
tbhattacharjee
|
|
|
|
|
There is a tool firebug install it in your browser, and with help of that you will be able to know what is the exact problem..
|
|
|
|
|
Tridip Bhattacharjee wrote: .how to make it compatible for all the browser.
You need to work on CSS. Need to create different css class insted of giving direct value in aspx page.
|
|
|
|
|
Use This code Solve ur prob..
<table cellspacing="1" cellpadding="1" bgcolor="#d8e4f8"
border="0">
<tr>
<td valign="top" nowrap >
<span id="Label2" style="font-weight: bold;">Date</span>
<input name="txtDate" type="text" readonly="readonly" id="txtDate" style="border-style: Groove;" /></td>
<td valign="middle" nowrap >
<span id="Label3" style="font-weight: bold;">Country</span></td>
<td valign="top">
<table id="chkCountry" border="0" style="font-weight: bold; ">
<tr>
<td>
<input id="chkCountry_0" type="checkbox" name="chkCountry:0" /><label for="chkCountry_0">UK</label></td>
<td>
<input id="chkCountry_1" type="checkbox" name="chkCountry:1" /><label for="chkCountry_1">USA</label></td>
<td>
<input id="chkCountry_2" type="checkbox" name="chkCountry:2" /><label for="chkCountry_2">Germany</label></td>
<td>
<input id="chkCountry_3" type="checkbox" name="chkCountry:3" /><label for="chkCountry_3">France</label></td>
<td>
<input id="chkCountry_4" type="checkbox" name="chkCountry:4" /><label for="chkCountry_4">Italy</label></td>
<td>
<input id="chkCountry_5" type="checkbox" name="chkCountry:5" /><label for="chkCountry_5">Canada</label></td>
<td>
<input id="chkCountry_6" type="checkbox" name="chkCountry:6" /><label for="chkCountry_6">Netherlands</label></td>
</tr>
</table>
</td>
<td valign="top" >
<button language="javascript" onclick="setTimeout('javascript:IsBusy(1);',50);
__doPostBack('btnGo','')" id="btnGo" type="button" value="GO">
</button>
</td>
</tr>
<tr>
<td valign="top">
</td>
<td valign="middle" >
</td>
<td valign="top" align="right" >
<a id="HyperLink1" href="EODMain.aspx">Main Menu</a></td>
<td valign="top" >
</td>
</tr>
</table>
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
thanks it works but u did not explain what u add or rectify. plzzz mention.
thanks a lot.
tbhattacharjee
|
|
|
|
|
I have a datalist and now i want to give custome paging to that datalist using multiple active result set. I mean i want to show paging as
first,previous,1 2 3. . . next, last.
In this I want to get only 3 pages at a time. and once i got the page, I want to put it in caching and again if user click on that page number then i dont want
to get the data from cache instead of hitting the database.pls its urgent.pls help me.
Happy
|
|
|
|