|
It was a trick answer. Of course you can't, you need to put it into some other sort of control, say a div, and you will have to do it in javascript unless you want to post back to the server each time. Now use you initiative and google, there are loads of examples
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
You can not do it in TextBox, You have to use div element. On keypress event, you have to call javascript function where you need to read all string of div by splinting space and check if word are in listing then add font attribute or span attribute around word and set style.
Search in google for how to write on div element.
Regard
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
I do not have too much knowledge of javascript. Please tell me the solution in c#.
|
|
|
|
|
Is there any way to use web proxy with SmtpClient Class.
I have to send mail from mail server smtp.gmail.com
If internet is directly available on my machine then everything is working fine. I can send a mail.
If My system is using proxy by proving it in Network connections then also it is working fine. But when i remove the proxy settings from Network connection and
Create a WebProxy object and assign Valid host and port then WebRequest object return HttpWebResponse properly ,
But i am not able to send mail by using SmtpClient.
I have even tried:
1) WebRequest.DefaultWebProxy
2) GlobalProxySelection.Select
3) DefaultProxy in Web.config
but result in Vain
I cant set Proxy in my network connection. Is there some work around to send mail. Either using TcpClient or any way.
Vikas Agarwal
|
|
|
|
|
Hi to all,
I am using a gridview to display products with a link "view details". When the user clicks on the "view details" for a product, all the details are displayed in the detailsview control. I the edit mode , if user don't want to edit the image, then the initial path saved in the label should go. The path is going but image is not displayed. I am unable to find the problem. Here is the code:
<br />
<asp:TemplateField HeaderText="Image"><br />
<ItemTemplate><br />
<asp:Label ID="lblimage" runat="server" Text='<%# Eval("image") %>' /><br />
</ItemTemplate><br />
<EditItemTemplate><br />
<asp:Label ID="labelImage" runat="server" Text='<%# Eval("image") %>' /><br />
<asp:FileUpload ID="UpldImage" runat="server" /><br />
</EditItemTemplate><br />
</asp:TemplateField><br />
FileUpload UpldImage = (FileUpload)DetailsView1.FindControl("UpldImage");
Label labelImage = (Label)DetailsView1.FindControl("labelImage");
string im = labelImage.Text;
if (UpldImage.HasFile)
{
string fileName = "~/ProductImages/" + UpldImage.FileName;
SqlDataSource2.UpdateParameters["image"].DefaultValue = fileName;
UpldImage.SaveAs(Server.MapPath(fileName));
}
else
{
SqlDataSource2.UpdateParameters["image"].DefaultValue = im;
UpldImage.SaveAs(Server.MapPath(im));
}
Please assist me...where I am going wrong.
cheers,
sneha
|
|
|
|
|
if (UpldImage.HasFile ) is False
Why do you need to cal UpldImage.SaveAs ??
If there is no file, no need to cal SaveAs.
Also you forgot to mention, what problem you are getting..
|
|
|
|
|
Hi,
The problem is that in the edit mode of details view a label and a file upload control is shown for the image. In the label control the current path is displayed. If the user doesn't changes the image then the path in label goes in the update function. And if the user changes the file then the path from the file upload control goes.
My problem is if the user does not change the image then the path from the label goes well but the image disappears from the front end. If I again choose the path from the file uploader then the image appears.
cheers,
sneha
|
|
|
|
|
strange behaviour is that the two paths for the image (one in the label and second when I again choose from the file upload) are same.But the image appears only when the path is choosen from the file upload.
cheers,
sneha
|
|
|
|
|
If you have already image in database and If user does not want to update image then why are you calling update method.
There are two ways.
1. dont update database if user does not select the file.
FileUpload UpldImage = (FileUpload)DetailsView1.FindControl("UpldImage");
Label labelImage = (Label)DetailsView1.FindControl("labelImage");
string im = labelImage.Text;
if (UpldImage.HasFile)
{
string fileName = "~/ProductImages/" + UpldImage.FileName;
SqlDataSource2.UpdateParameters["image"].DefaultValue = fileName;
UpldImage.SaveAs(Server.MapPath(fileName));
}
2. Update database if you want but dont save image again because you have already file in folder.
FileUpload UpldImage = (FileUpload)DetailsView1.FindControl("UpldImage");
Label labelImage = (Label)DetailsView1.FindControl("labelImage");
string im = labelImage.Text;
if (UpldImage.HasFile)
{
string fileName = "~/ProductImages/" + UpldImage.FileName;
SqlDataSource2.UpdateParameters["image"].DefaultValue = fileName;
UpldImage.SaveAs(Server.MapPath(fileName));
}
else
{
SqlDataSource2.UpdateParameters["image"].DefaultValue = im;
}
If you dont want to update any code, then please check else condition, what does im contain? and after executing else code, please check your folder to verify that file is exist or not. degun the code, you will get an idea.
Regard
please don't forget to vote on the post that helped you.
|
|
|
|
|
Imran Khan Pathan wrote: If you dont want to update any code, then please check else condition, what does im contain? and after executing else code, please check your folder to verify that file is exist or not. degun the code, you will get an idea.
I already checked the else condition and on debugging found that "im" contains the correct path. And the image folder still contains the image. But strange behaviour is image disappears.
I dont know why it is happening.
cheers,
sneha
|
|
|
|
|
Hi all,
can anybody pls tell me which software is better to create flash file by using my photo albums.So that i want to include it in my home page.
advance thanks
|
|
|
|
|
Did you try Adobe Flash ?
You can easily import images to the Flash timeline and render to a Flash movie.
|
|
|
|
|
What is the use of enableEventValidation="false" and enableEventValidation="true" ?
|
|
|
|
|
Are you aware about the documentation?
The event validation mechanism reduces the risk of unauthorized postback requests and callbacks. When the EnableEventValidation property is set to true, ASP.NET allows only the events that can be raised by the control during a postback request or callback.
This event validation mechanism reduces the risk of unauthorized postback requests and callbacks. With this model, a control registers its events during rendering and then validates the events during the post-back or callback handling. All event-driven controls in ASP.NET use this feature by default.
In simple, it is a security mechanism implemented by the ASP.NET framework to prevent invalid postbacks happening.
Best wishes,
Navaneeth
|
|
|
|
|
how can print a document just clicking on its link,I searched a lot on google but getting methods to print open document/currnt document
modified on Friday, December 18, 2009 2:24 AM
|
|
|
|
|
|
infact i have tried the same link as you have reffered , but it print currnt document not the document that is referenced in link
|
|
|
|
|
Hi
You can use ajax.
when the ajax response recived
you can use this javascript code
var pp = window.open('', '','left=0,top=0,toolbar=0,scrollbars=1,status=1');
pp.document.body.innerHTML += cPrint;
pp.document.close();
pp.focus();
pp.print();
"cPrint" is the document text.
Mohammad Khansari
|
|
|
|
|
Dear All,
I am having a problem while hosting wcf services with iis with multipel end points.By default it is selecting wshttpbinding and working fine.But i need to provide 1)BasicHttp EndPoint and 2)NettcpEndPoint. to provide communication with one network desktop app and one web application.Please give me the required.
Regards,
P.Sri Pavan.
|
|
|
|
|
sreepavan150385 wrote: I am having a problem while hosting wcf services with iis with multipel end points
What problem are you facing for giving multiple endpoint ?
And, This is ASP.NET Forum. You should ask this question in WPF/WCF/WF Forum.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Dear Abhijit Jana,
Thanku for ur responce toword my request.I kn explain briefly the problem wat i am facing.
IF WCF HOSTED outside IIS(ex:Trough console App)
I had provided 2 end points with multipel bindings(Net.tcp,BassicHttp)with their port numbers.so when i run this service then only i kn abel to acess this service trough end points.other wise it is showing Tcp error..
IF WCF HOSTED with IIS:It is default providing wshttpbinding.buy building the application i can acesses this services no need of running.but wen i provided it with multipel end points and trying to acess the services without running it is showing TCP error.i want it to work like webservices but to provide multipel bindings.
If possibel pls give an sample code application for my requirment.
Regards,
P.Sri Pavan.
|
|
|
|
|
We have a meeting app that tracks meetings across timezones. The app shows 3 days worth of data. The original programmers created a time table that contained each time(in 30 min increments) with an offset for the day. So, there are 48 times with the offset of -1, followed by another 48 with an offset of 0, and another set with an offset of 1. This structure supposedly worked well when they had one timezone.
But now there are several timezones in a grid. The times are displayed as the same UTC time across several timezones. So, in London, the time is the UTC, and in NY the time is shown on the same row as ET.
The created a stored proc that creates a temp table and adds a column for each selected conference room.
All dates are stored in the tables as UTC. When we are retrieving the data, it is converted to the correct timezone.
With that ridiculously long background, the client wants tooltips with the correct Date and time of each cell. Before the other timezones, they used the offset. But now we're stuck with figuring how to get the correct date in the tooltip across the entire grid. Times are fine, date gets hosed as soon as it passes the UTC midnight (offset). Then it increments a day when the offset increments, but the UTC time offset also increments the date
I know the answer is probably simple, but I'm not seeing it (and neither is my colleague). Any help greatly appreciated.
|
|
|
|
|
Is it possible to insert a default value to a textbox if a SUM doesn't return a value? If so, how? My SELECT statement is:
SelectCommand="SELECT Projekter.ProjektId, Projekter.Projektnavn, Projekter.Projektbeskrivelse, Projekter.Organisation, Projekter.[Afdelingschefs godkendelse] AS Afdelingschefs_godkendelse, Projekter.Købsordrenummer, Projekter.SamletFaktureringsskønForProjektet, Projekter.MedarbejderId, Projekter.Projektstartdato, Projekter.Projektslutdato, Projekter.[Direktions godkendelse] AS Direktions_godkendelse, Projekter.Bemærkninger, Projekter.[Sidste bogføring] AS Sidste_bogføring, Projekter.Kundenr, Projekter.Leasingnr, Projekter.Adresse, Projekter.Postnr, Projekter.[By], Projekter.Afsluttet, SUM(Udgifter.Brugtbeløb)-Projekter.SamletFaktureringsskønForProjektet AS Expr1 FROM Projekter INNER JOIN Udgifter ON Projekter.ProjektId = Udgifter.ProjektId GROUP BY Projekter.ProjektId, Projekter.Projektnavn, Projekter.Projektbeskrivelse, Projekter.Organisation, Projekter.[Afdelingschefs godkendelse], Projekter.Købsordrenummer, Projekter.SamletFaktureringsskønForProjektet, Projekter.MedarbejderId, Projekter.Projektstartdato, Projekter.Projektslutdato, Projekter.[Direktions godkendelse], Projekter.Bemærkninger, Projekter.Kundenr, Projekter.Leasingnr, Projekter.Adresse, Projekter.Postnr, Projekter.[By], Projekter.[Sidste bogføring], Projekter.Afsluttet HAVING (Projekter.ProjektId = @ProjektId) AND (Projekter.Afsluttet = @Afsluttet)"
|
|
|
|
|
I don't know exactly what you mean, but I understand it as the following.
If Sum(...) Is NULL, Use value XXX
You should look at the function COALESCE http://msdn.microsoft.com/en-us/library/ms190349(SQL.90).aspx[^]
And you would like to use it as so: COALESCE(SUM(Udgifter.Brugtbeløb),XXX) where XXX is the default value.
|
|
|
|
|
It works fine when SUM returns a value. If not the FormView is completely empty.
|
|
|
|