|
Then do it. Just handle the keypress of the textboxes you want, and use javascript to put dashes between numbers.
You might also consider Regular Expression to validate the CNIC number after user input. (Might also make use of RegularExpressionValidator).
\d{5}[-|]\d{7}[-|]\d
I think this will work as regular expression. Try it. Well I agree, it can be made shorter.
Cheers.
|
|
|
|
|
Respected,
Can me upload a file without file uploade control.
Thanks.
|
|
|
|
|
Try this..!
http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
FileUpload and input type="file" is the same thing. You might use either of them.
You can even trigger the Browse button click when some other control is clicked, but with normal html, it is not possible to upload the file without browser FileUpload .
May be you can use flash object to invoke openfiledialog without FileUpload control. Many sites uses Flash OpenFileDialog to have multiselection of files enabled. It wont be possible for normal html file upload control.
|
|
|
|
|
lrsalunkhe wrote: Can me upload a file without file uploade control.
Why ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
You can use js to upload file. Please refer to the following example:
<script>
function mCreateFile(obj){
var eF
var mName
mFileName.innerHTML=""
if (obj.id=="File") {
for (i=0;i <mFile.l.length-1;i++)
{
if (mFile.children[i].value=="") {
mFile.removeChild(mFile.children[i])
}
else
{
mName=mFile.children[i].value.split("\\")
mFileName.innerHTML+=" <div id=NameDetail title='"+mName[mName.length-1]+"'>"+mName[mName.length-1]+" </div>"
}
}
mstatus.innerHTML="There are <b>"+(mFile.children.length-1)+" </b> file to upload"
}
if (obj.id=="File_New") {
eF=document.createElement(' <input type="file" name="File" size="23" id=File_New onpropertychange="mCreateFile(this)">')
mFile.appendChild(eF)
obj.id="File"
}
}
</script>
April
Comm100 - Leading Live Chat Software Provider
|
|
|
|
|
Hi,
I am sending emails through webservices, I am calling the webservice from my website and passing all the arguments to it ,until now no problem.
But now I want the webservice to inform the user if an error or exception occurs is there a way by which I can do so?
Any help shall be appreciated
Thanks
Shankbond
|
|
|
|
|
Return the exception in the form of String format...!
[WebMethod]
Public string SendMail()
{
try
{
return "mail sent";
}
Catch(Exception ie)
{
return ie.Message;
}
}
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi,
Your method is very simple but when I tried to send the mail using webservice
I tried like:
testingservice service=new testingservice;
string message=service.send mail(,,,.....parameters);
where as I have declared the web service as
[WebMethod]
Public string SendMail(,,,.....parameters)
{
try
{
return "mail sent";
}
Catch(Exception ie)
{
return ie.Message;
}
}
I get an error and the application fails to rebuild
Cannot implicitly convert type 'System.IAsyncResult' to 'string'
Please reply
Thanks
Shankbond
|
|
|
|
|
Hi,
You misunderstood i think..!
You have to write a web method for sending mail
[WebMethod]
Public string SendMail(,,,.....parameters)
{
try
{
return "mail sent";
}
Catch(Exception ie)
{
return ie.Message;
}
}
if you wrote the logic for sending the mail show me the code..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi,
here is the code:
protected void Button4_Click(object sender, EventArgs e)
{
testingservice service = new testingservice();
AsyncCallback callback = new AsyncCallback(hello);
service.BeginSendMailGmail1(TextBoxto.Text.ToString(), TextBoxcc.Text.ToString(), TextBoxbcc.Text.ToString(), TextBoxbody.Text.ToString(), TextBoxsubject.Text.ToString(), TextBoxusername.Text.ToString(), TextBoxpassword.Text.ToString(), TextBoxserver.Text.ToString(), TextBoxport.Text.ToString(), TextBoxdisplayname.Text.ToString(),callback,sender);
Response.Redirect("default4.aspx");
}
here is the other method but it will always be completed =true
void hello(IAsyncResult result)
{
if (!result.IsCompleted)
{
Response.Write("failed");
}
}
the code for webservice:
[WebMethod]
public string SendMailGmail1(string To, string Cc, string Bcc, string body,string subject, string user_name, string password, string server_name, string portnumber, string display_name)
{
SmtpClient client = new SmtpClient();
MailMessage message = new MailMessage();
client.Port = Convert.ToInt32(portnumber);
client.Host = server_name;
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential(user_name, password);
client.EnableSsl = true;
try
{
message = new MailMessage(new MailAddress(user_name, display_name), new MailAddress(To));
if (Cc != "")
{
string[] array1 = Cc.Split(',');
for (int i = 0; i < array1.Length; i++)
{
message.CC.Add(array1[i].ToString());
}
}
if (Bcc != "")
{
string[] array2 = Bcc.Split(',');
for (int i = 0; i < array2.Length; i++)
{
message.Bcc.Add(array2[i].ToString());
}
}
message.Body = body;
message.Subject = subject;
message.IsBodyHtml = true;
client.Send(message);
message.Dispose();
return "sent successfully";
}
catch (Exception ex)
{
return ex.Message.ToString() + "----" + ex.InnerException.ToString();
}
}
Thanks
Shankbond
|
|
|
|
|
shankbond wrote: AsyncCallback callback = new AsyncCallback(hello);
I dont Understand why you need asychronous?
here is sample code i developed now
Modify your code depending on your requirement...!
[WebMethod]
public string SendMail()
{
try
{
MailMessage msg=new MailMessage ("From@xxx.com","To@xxx.com","Sub","body");
SmtpClient client = new SmtpClient("YourDomain", 25);
client .Send (msg);
return "hai";
}
catch (Exception ie)
{
return ie.Message ;
}
}
For Calling Webservice..!
localhost.WebService rss = new localhost.WebService();
string msg=rss.SendMail();
Response.Write(msg);
I am Going Bye May the group will help if you need further assistance..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
If The Web Service is in you application Keep the break point and check wats happening in webservice..!You can track the problem..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Cool it worked thanks.
I need the asynchronous mode only one problem left now how to pop up a message box or so, when the user is simply surfing on some other page?
Thanks
Shankbond
|
|
|
|
|
is there a way that I can add to Your reputation
Thanks
Shankbond
|
|
|
|
|
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
shankbond wrote: is there a way that I can add to Your reputation
I dont Know Much Abt reputation may be its new in codeproject I will Let you know After I know abt fully..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
HI Experts,
I have done designing on my computer...it looks good when i run it on browser..but when the same project is run on other machine which has little wider screen(19" monitor) the font,size of the controls does not remain same...i have used all HTML tables and placed controls in table...
I haven't used tags....will it b the reason ?
Sharing Of Knowledge Provides Solution....
|
|
|
|
|
If you are using css then apply following property in body tag of css
padding: 0 px;
margin:0auto;
Hope this will help you.....
Life Is Beautiful
|
|
|
|
|
Different monitors will always display web pages and applications differently.
To get round this always use a style sheet or inline styles if needed. Set widths, heights and font sizes to percentages. Within reason your page should display the same what ever the monitor.
|
|
|
|
|
Below line of code is working with IE but not with FireFox.
if(navigator.appName == "Microsoft Internet Explorer")
{
document.getElementById('txtEstimatedCommission').innerText = Commission.toFixed(2);
}
else
{
document.getElementById('txtEstimatedCommission').textContent = Commission.toFixed(2);
}
Please let me know where I am wrong.
Thanks
|
|
|
|
|
tRY value it will work in both..!
document.getElementById('<%= txtEstimatedCommission.ClientID %>').value=Commission.toFixed(2);
or
document.getElementById('<%= txtEstimatedCommission.ClientID %>').innerhtml=Commission.toFixed(2);
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
|
Any Time..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi all,
How i write a java script function which validates if Outer Gridview Checkbox is checked then inner grdiview Checkboxes not checked
if any of the inner Gridview Checkbox checked then Outer Gridview Checkbox will not Checked .
Best Regards,
Rameez
|
|
|
|