|
I want to draw a polygon using Graphic class on a webform, I use the following code but it doesn't show anything!!!
protected void Page_Load(object sender, EventArgs e)
{
Bitmap objBitmap;
Graphics objGraphics;
objBitmap = new Bitmap(400, 440);
objGraphics = Graphics.FromImage(objBitmap);
objGraphics.Clear(Color.Blue);
}
even I delete all the HTML tag except
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImageResults.aspx.cs" Inherits="Yadgirandeh.WebForm5" %>;
I would be really grateful if anybody helps me.
|
|
|
|
|
You need to set the response type of the response, and then write the bitmap to the output stream of the response.
Something like (after your existing code)...
Response.ContentType = "image/jpeg";
Response.Clear();
Response.BufferOutput = true;
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.Flush();
Assuming your other code is correct which I haven't really checked.
|
|
|
|
|
Dear All,
I have a serious problem with my website now, it is working very slow and i have to wait for 20 minutes for response.
I have a website using ASP.NET/C# connect to SQL SERVER 2008, webserver is IIS7 and .NET Framework v2.050727
Do you have any ideas?
I need your helps.
Thank you very much.
Best regards,
HY ChanHan
|
|
|
|
|
what have you done to isolate the problem? Is it the page rendering, the data access, or something else. How much ram? Is everything on a single machine? How much traffic? What is the network like? There are any number of things that could causing you problems, but with details we can't help
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I cannot find the problem at all now
RAM is 16GB.
my hosting server is Redundency (Clusters).
Network Architectures has:
1. Firewall
2. Switch
3. Check point
4. NAS (store photos)
5. SAN (database)
Please helps.
Best regards,
HY Chanhan
|
|
|
|
|
what about your code? How are you accessing the database? How is it being rendered? Please don't dump your entire application here either
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Codes is working fine, i have moved it to other machine and test my codes already it works fine as usual.
It just get slow performance this 30 days, before it works fine.
|
|
|
|
|
Well, if you are so convinced that neither the code nor the network or machine is the problem then I don't know what you expect any of us to do.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Have you contacted you hosting company?
Maybe they have a problem, or your ISP is having difficulties.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
hi all,
i have a webserver in which we host the web application
and a database server i.e sql server both server are different.
now my web page needs to interact with autocad application
but autocad is not installed in the webserver but it is installed in database server
i have a restriction to not to install the auto cad in web server but my web page should
interact with autocad application & generate the drawings in client system.
how can we solve this problem...
regards
vijay kumar
|
|
|
|
|
Hi,
I am mani. I have a problem in display the data in datagrid.
What i did is I am creating a form and in this form i created a 6 textboxes and one search button. whenever the user enter a text in textbox i retrieve the data from the database and displayed in the datagrid.
The problem is when the user again enter the text in text box the datagrid is filled with new data and last data will be lost. But i want that newly searching data should be displayed in datagrid including the last searching data.
This is my problem i sent last time to this portal. i got some answers. But using the DataTable i didnt get the answer. I write my code here. please tell me what is the wrong i did it in this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class AdvanceSearch : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter adptr;
DataTable dt;
DataView dv;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["mani"] == null)
{
dt = new DataTable();
Session["mani"] = dt;
}
else
{
dt = (DataTable)Session["mani"];
}
dv = new DataView(dt);
SearchResultGrid.DataSource = dv;
SearchResultGrid.DataBind();
}
protected void ButtonSearch_Click(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=MVB;Initial Catalog=Communication; Integrated Security=True");
string select_query = "SELECT *FROM CommunicationDetails WHERE CommunicationId=@comid OR IssueType=@issue OR RegionName=@regname OR ApplicationName=@appname OR Descript=@Desc OR CommunicationDate=@comdate";
cmd = new SqlCommand(select_query, con);
cmd.Parameters.Add("@comid", TextBoxCommunicationID.Text);
cmd.Parameters.Add("@issue", TextIssueType.Text);
cmd.Parameters.Add("@regname", TextBoxRegionName.Text);
cmd.Parameters.Add("@appname", TextBoxApplicationName.Text);
cmd.Parameters.Add("@Desc", TextBoxDescription.Text);
cmd.Parameters.Add("@comdate", TextBoxDate.Text);
try
{
con.Open();
adptr = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adptr.Fill(ds);
dt = ds.Tables[0];
dv = new DataView(dt);
SearchResultGrid.DataSource = dv;
SearchResultGrid.DataBind();
con.Close()
}
catch(SqlException)
{
con.Close();
}
}
}
using this code i get the answer every time the user enter the data to search. but the last time the user searched data will be lost. i want that last time searching data including the present data.
regards,
Manikanta.
|
|
|
|
|
One possibility is that when you make a new query:
- save the last results in a datatable 1 (the currently binded datatable)
- execute a new query
- from the query save the results to datatable 2
- merge datatable 1 and 2 to datatable 3
- bind the datatable 3 to the grid
You can do this with two datatables also if you want. For information about Merge, see http://msdn.microsoft.com/en-us/library/fk68ew7b.aspx[^]
|
|
|
|
|
hello sir,
I have a small problem how we can create chat application(video or audia) using asp 2.0. Actually i am working on Ecourt website i have a small requirment to chat face to face audio or video but i dont find any solution please help me.....
Avanish Kumar Rathour
faculty
(GL:- NIIT MORADABAD)
09456019010
|
|
|
|
|
have you tried skype? or google talk (I think they now have video too)?
|
|
|
|
|
|
Have a look at the below link
Link1[^]
Link2-[Video chat & Voice Chat][^] to read discussion having same question with perfect solutions
Link3[^] to download Videos Tutorial.
and Finally don't forget you have to create ActiveX control that visitors must have to installed its just because of Because a webcam is a clientside device you cannot control it from a serverside-codebehind.
|
|
|
|
|
Hello;
In the master page of my site I have a textbox that displays the school year, to recover the value of textbox in other pages I used:
page.master.cs
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Label13.Text = Convert.ToString(DateTime.Now);<br />
SqlConnection myConnection = new SqlConnection(ConnectionString);<br />
myConnection.Open();<br />
<br />
<br />
String maRequete = "select ann_uni as [p1]from annee where @param between date_debut and date_fin";<br />
SqlCommand myCommand = new SqlCommand(maRequete, myConnection);<br />
myCommand.Parameters.Add(new SqlParameter("@param", SqlDbType.DateTime));<br />
myCommand.Parameters["@param"].Value = Label13.Text;<br />
SqlDataReader drr2 = myCommand.ExecuteReader();<br />
<br />
<br />
while (drr2.Read())<br />
{<br />
Textbox1.Text = drr2["p1"].ToString();<br />
}<br />
drr2.Close();<br />
<br />
}<br />
private string ConnectionString<br />
{<br />
get<br />
{<br />
string connectionString = (@"Data Source=.\SQLEXPRESS;UID=sa;Password=*****;Initial Catalog=bd1");<br />
<br />
return connectionString;<br />
}<br />
}<br />
public string ContentTextBoxOfMasterPage<br />
{<br />
get { return Textbox1.Text; }<br />
}
defaul2.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Page sans titre" %><br />
<%@ MasterType virtualPath="~/MasterPage.master"%><br />
<br />
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"><br />
</asp:Content><br />
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></asp:Content><br />
Default2.aspx.cs
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
TextBox2.Text = Master.ContentTextBoxOfMasterPage;<br />
}
MasterPage.master
<asp:TextBox ID="Textbox1" runat="server"></asp:TextBox><br />
<br />
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"><br />
</asp:ContentPlaceHolder><br />
</div><br />
</form><br />
</body><br />
</html><br />
But TextBox2 is empty.
thank you
|
|
|
|
|
And have you debugged and stepped through to ensure the code is working? Are you getting a value from the database?
A few tips:
DON'T hard code your connection string in your code, that is what the configuration file is for. See the element called connectionStrings? Guess what that is for.
If you are returning a single value than use ExecuteScalar
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hello;
the value of Textbox1 is 2010/2011 is retrieved from the database but the problem is to pass it to TextBox2.
Thank
|
|
|
|
|
You have got to give more information in your posts. We are not sitting next to you looking over your shoulder.
What do you mean "the problem is to pass it to TextBox2"? Is the datareader valid? Do you have a value to assign? Is the problem extracting the value from the textbox rather than assigning it?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Can you try, in Default2.aspx.cs : Page_Load
Control masterControl = Master.FindControl("TextBox1");
if(masterControl != null)
{
string textToCopy = (TextBox)masterControl.Text;
TextBox2.Text = textToCopy;
}
Debug, and let us know if 1) masterControl is not null and 2) if textToCopy gets populated
|
|
|
|
|
Hi;
I try:
Control masterControl = Master.FindControl("TextBox1");
if(masterControl != null)
{
string textToCopy = (TextBox)masterControl.Text;
TextBox2.Text = textToCopy;
} else{TextBox2.Text="rr";
} result:TextBox2 is empty
|
|
|
|
|
((Label)Master.FindControl("lblTopUpMsg")).Text = "Text in Chield Page";
Here lblTopUpMsg is a Label Name of Master page.
|
|
|
|
|
Hi,
I am mani. I have a problem in display the data in datagrid.
What i did is I am creating a form and in this form i created a 6 textboxes and one search button. whenever the user enter a text in textbox i retrieve the data from the database and displayed in the datagrid.
The problem is when the user again enter the text in text box the datagrid is filled with new data and last data will be lost. But i want that newly searching data should be displayed in datagrid including the last searching data.
If anyone knows the way how it should be doing please rly me. and provide an example in maintaing a datatable session variable.
regards,
manikanta.
|
|
|
|
|
This problem can be solved if u use datatable.
The data that was present on the data grid just fill this data to datatable and then the new searched data will also be filled in the same datatable then bind this datatable to the grid so that the previous data will not be lost.
|
|
|
|