|
Don't start a new thread to say thank you, answer on the existing thread. It's great that you say thanks, few people do. But, it's better for it to be on the same thread, not least because the person who answers you then gets an email.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How can I set a textbox value to a number....I tried the ToString method but im not sure
|
|
|
|
|
OlieColie wrote: How can I set a textbox value to a number....I tried the ToString method but im not sure
What do you mean you are not sure? You are not sure that will work? You are not sure it is the best way?
Have you tried it? Did it work?
MyTextBox.Text = myNumber.ToString();
There isn't much more to it than that.
|
|
|
|
|
OlieColie wrote: How can I set a textbox value to a number....I tried the ToString method but im not sure
Your question doesn't make any sense. Do you want to case text box value to a number ? Then check the following code
int MyNumber = (int)Text1.Text;
int MyNumber = int.Parse(Text1.Text);
int MyNumber = Convert.ToInt32(Text1.Text);
These are different methods for casting
|
|
|
|
|
Hello,
I recently constructed an asp site using simple server controls for input. The site consists of several pages that list buttons dynamically based on what was clicked on the previous page. Everything worked great with Buttons or ImageButtons. We just received the complete site's UI from a graphic designer that uses HTML/CSS. I'm now trying to integrate everything and in one particular case I have to keep the buttons as anchors so the CSS displays everything properly. If I manually write the anchor on the html side as the following: <a href="" mce_href="" id="Wireless" runat="server" onserverclick="catButton_Click">Wireless</a> then it creates a button and I can catch the event in the code behind. Since I need to have these buttons appear dynamically, I have to do this in a loop in the code behind.
In the code behind I am creating the corresponding Div tag and creating a PlaceHolder inside. I am using div.InnerHtml += <a href=\"#\" onserverclick=\"catButton_Click\" runat=\"server\" id=\"" + arr[i].ToString() + "\">" + arr[i].ToString() + "</a>
This displays all the buttons on the page, and it successfully posts back when I click the button, but it does not register correctly as an event. I have a feeling it has something to do with other server controls on the page that also use __doPostBack and somehow the order of things is messed up. I'm still a beginner in ASP.NET so I could be missing something but any help is GREATLY appreciated as I'm working on a short deadline. Thanks,
Forrest
|
|
|
|
|
When I set a onClientClick=”jsfunction()” on a submit button the validationsummary message box would not show up; How can I trigger validationsummary message box in the function jsfunction() if it is invalidate page?
|
|
|
|
|
You can call the javascript methods to fire validation directly. It's Page_Validate(), I believe.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have created a table that pulls from a database of users' comments. As it is sort of a wiki, I want the user and/or other users to be able to edit the comments once they have been posted. However, when I try to add an Edit button, it requires that I append .toString(), which causes the button to appear as System.Web.UI.WebControls.ImageButton instead of an actual working image button. Is there any way to add a button that actually works? And, yes, I am aware that the code is incomplete and that the button does not currently DO anything. Right now I'm just trying to make it show up. Any help would be greatly appreciated.
while (reader.Read())
{
HtmlTableRow r = new HtmlTableRow();
HtmlTableCell c0 = new HtmlTableCell();
c0.InnerText = reader[0].ToString();
HtmlTableCell c1 = new HtmlTableCell();
ImageButton a = new ImageButton();
c1.InnerHtml = a.ToString();
r.Cells.Add(c0);
r.Cells.Add(c1);
table.Rows.Add(r);
}
|
|
|
|
|
Have you tried c1.Controls.Add(a) instead of c1.innerhtml =
|
|
|
|
|
Beautiful! Thank you so much.
|
|
|
|
|
HI,
we have a web service and our application(.net 1.1, C#, oracle) consumes this web service. By default the security(authentication) is given anonymous, now as for security reasons we want to remove this option.
So lets say we use Integrated Windows Authentication. Doing so we would get Access Denied 401 error. On searching though it is found that we could pass few credentials and access the web service (this works fine)
What are the cons in providing user credentials in the code?
What are the steps to be followed to make a web service secure and accessible?
Is there a way that a web service can be accessed after removing anonymous access and not providing any credentials in the code?
gauthee
|
|
|
|
|
|
Thanks Balaji!
the article was helpul however it was just an abstract! Is there some sort of practical example so that it would be easy for us to relate!
gauthee
|
|
|
|
|
hi all... i am getting the following problem while connecting to the .mdf file
"failed to generate a user instance of SQL Server.
Only an integrated connection can generate a user instance.
The connection will be closed"
how to fix this error????????
|
|
|
|
|
|
Could someone tell me where to find a good server capture applicatio, i want to see what is post back to the server any time i make a request.
i just went to Adobe MAX and I saw someone using it, but i couldnt find the name of it.
thanks
|
|
|
|
|
I have a web app. where I take user information and create a business card image. My question is, How do I convert that jpeg image I have into a pdf?
|
|
|
|
|
From whatever image editor you're using for your jpg, you can convert the image into a pdf by going to the Print menu and selecting your pdf maker. I use Adobe Acrobat and highly recommend this, as it creates smaller, clearer files. However, there are also several free pdf creators on the intranet, such as www.primopdf.com, www.cutepdf.com, etc. If you're wanting to create the pdf automatically as part of the application, I'd need more information about what language you're coding your program in.
|
|
|
|
|
I'm actually using C# to work with my jpeg image. In fact hear is the code behind so you can get general idea as to what I'm talking about.
using System;
using System.IO;
using Microsoft.VisualBasic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Imaging;
using System.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TextOnImage
{
public partial class TextOnImage : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
//Load the Image to be written on.
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("Wayland_Tmp_RGB.jpg"));
Graphics graphicImage = Graphics.FromImage( bitMapImage );
SolidBrush brush = new SolidBrush(Color.FromArgb(12,39,120));
//Code for Name.
FileStream file = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Name.txt",FileMode.OpenOrCreate,FileAccess.Read);
StreamReader name= new StreamReader(file);
//Code for Title1.
FileStream file1 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl1 = new StreamReader(file1);
//Code for Title2
FileStream file2 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl2 = new StreamReader(file2);
//Code for the Campus
FileStream file3 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Campus.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader cmp = new StreamReader(file3);
//Code for the CityStateZip
FileStream file4 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin1 = new StreamReader(file4);
//Code for the Phone
FileStream file5 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin2 = new StreamReader(file5);
//Code for the Fax
//Smooth graphics is nice.
//graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
//graphicImage.CompositingQuality= CompositingQuality.HighQuality;
graphicImage.TextRenderingHint= TextRenderingHint.ClearTypeGridFit;
//Reads the text file info.
string n=name.ReadLine();
string t1=ttl1.ReadLine();
string t2=ttl2.ReadLine();
string c=cmp.ReadLine();
string ln1=lin1.ReadLine();
string ln2=lin2.ReadLine();
int x;
string read = null;
if ((read=t1)!=null)
{
x=1215;
//Title#1
graphicImage.DrawString(t1.PadLeft(t1.Length), new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x-(t1.Length*12), 525));
//Name
x = x - (t1.Length*14);
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length) * 16, 525));
}
else
{
x=1200;
//Name if there is no Title#1
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length+2)*12 , 525));
}
//*****************************Title#2***And***Campus****************************************//
if (((read = t2) != null) & ((read = c) != null))
{
x = 1190;
//Title#2 if there is a Title#2
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 12, 575));
//Campus
x =1135;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 625));
}
//Code for Campus if there is now Title#2
else
{
if ((read = c) != null)
{
x = 1185;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 575));
}
else
{
//Title#2 if Campus is entered into Title@2
x=1215;
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 13, 575));
}
}
//**************************Line1****of**the**Card******************************************//
x=1200;
graphicImage.DrawString(ln1, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln1.Length) * 12, 700));
//**************************Line2****of**the**Card******************************************//
x = 1200;
graphicImage.DrawString(ln2, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln2.Length) * 12, 750));
//This code is to test the positioning of the information
// graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 575));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 625));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 675));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 725));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(0, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1485, 525));
//Closing all files.
name.Close();
file.Close();
ttl1.Close();
file1.Close();
ttl2.Close();
file2.Close();
cmp.Close();
file3.Close();
lin1.Close();
file4.Close();
lin2.Close();
file5.Close();
//Set the content type
Response.ContentType="image/jpeg";
//Save the new image to the response output stream.
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//Clean house.
graphicImage.Dispose();
bitMapImage.Dispose();
}
//private Brush Color()
//{
// throw new Exception("The method or operation is not implemented.");
// }
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
}
#endregion
}
}
I got the source code from someone in Code Project and kind of made my own thing with it, but like I said before the graphics dept. is unable to use the jpg image because when they convert it to cmyk all the brush strokes show up and we can't have that. Any suggestions at this point would be greatly appreciated.
Thanks,
Armando
|
|
|
|
|
It seems to me that you probably just want to create the PDF ahead of time, seeing as all these paths are hard coded. You also shouldn't be doing this sort of heavy lifting in your presentation layer.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If I can some how raise the DpiX to 300, and the DpiY to 300 then I believe this will all work.
|
|
|
|
|
The DPI of a monitor is typically 72 or 96. DPI is actually just rendering metadata, it's got nothing to do with the file itself ( that is, it's independant of resolution )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok, so how would I go about fixing the garbage around the text. I've tried playing around with the smoothe antialias option and things of that nature, but have had no new results.
|
|
|
|
|
antialiasing is different to noise removal. I don't even know what garbage you're talking about, is it on the jpeg, or just the PDF. DPI will not resolve this either, you need to work out what the noise is, and remove it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
When you look at the image after the business card is produced it looks fine. The problem comes when the graphics dept. converts the image to cmyk which causes the Rasterizing of the image, and converting it to cmyk is a must if your going to print the card on the press' that we have. I'm just at a loss right now.
|
|
|
|
|