|
I would lke to generate an image based from my webpage. Only the top 150 pixels by 40.
Is there a way to take the designated pixels and take a screen shot into an image?
thanks
|
|
|
|
|
Bitmap bmp = new Bitmap(Server.MapPath("web.jpg"));
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
//set Name
g.DrawString(this.txtName.Text,
new Font("Arial", 14), SystemBrushes.WindowText, 110, 10);
//set Title
g.DrawString(this.txtTitle.Text,
new Font("Arial", 8), SystemBrushes.WindowText, 115, 30);
//set Address
g.DrawString(this.txtAddress.Text,
new Font("Arial", 8), SystemBrushes.WindowText, 115, 55);
//set web URl
g.DrawString(this.txtWebURL.Text,
new Font("Arial", 8), SystemBrushes.WindowText, Convert.ToInt16(this.TextBox1.Text), Convert.ToInt16(this.TextBox2.Text));
Response.ContentType = "image/gif";
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
I figured out how to make this file. How do I make this applicaion download this file instead of displaying it on the screen? Right now it renders the image but when I try to download it windows OS doesnt recognise it as an image.
|
|
|
|
|
I'm still having some issues with sorting a dynamically created Gridview. I have an objectdatasource and a gridview that I set on the fly depending on which report is chosen from a drop down. This is working fine except for when I sort on one report and then try to select another report from the drop down. The GridViewSortEventArgs.SortExpression still holds the value of the previous report's sort column. Is this a futile attemt to change this value? The only place it seems I can clear it is in a custom sort event but that is where I need it. GridView.SortExpression is read only from what I can tell so I don't think I can clear that. Little help?
Darren
|
|
|
|
|
|
hi all,
I am creating image button control dynamically with the appropriate images to its url property.
The problem is i want to identify which image button has been clicked and take appropriate actions according to image clicked. i want to know how to make click event to fire.
if u can provide any exixting code it woud be great for me
i am using asp.net and c#.
i am struck up here,please provide me information on this in detail(if posible along with code)
...
krish
krish
|
|
|
|
|
Register the event dynamically like…
Control.event+=new eventhandler(function);
Thomas
|
|
|
|
|
Hi.
I am trying to set a link conditionally if a piece of data exists.
<code><tr class="bodytext">
<td><a class="grayUrl" href="http://<%#DataBinder.Eval(Container.DataItem, "URL")%>"> <%#DataBinder.Eval(Container.DataItem, "SiteName")%></a>
</td>
</tr></code>
This puts a link on the page... but I only want it there if the database field DataBinder.Eval(Container.DataItem, "Link") is set to true.
I am using .net 2.0 and VB.net
Séan
|
|
|
|
|
Use a server side function to get the URL. Pass the database fields to this function and check there the “Link” is true or false. If the “Link” is true return the concatenated string of “URL” and “Sitename”. If the link is false return the “#”.
Thomas
|
|
|
|
|
Thank you for the answer...
Take it as read that I am a newbie - this code does not work and it is probably because I am doing something wrong:
Dim dbread As OleDbDataReader = dbcomd.ExecuteReader()
Sites.DataSource = dbread
Sites.DataBind()
strNewUrl = check_Review(dbread.GetValue("Review"))
dbread.Close()
dbconn.Close()
End Using
End Sub
Private Function check_Review(ByVal review)
Return ("<%<a class='grayUrl' href='http://<%#DataBinder.Eval(Container.DataItem, 'URL')%>' title='<%#DataBinder.Eval(Container.DataItem, 'SiteName')%>'><%#DataBinder.Eval(Container.DataItem, 'SiteName')%></a>%>")
End Function
End Class
Also - what is the correct method for assigning a new value to the data column as I prepare to write the data to the page? Or am I going about this all wrong?
|
|
|
|
|
Do like this. Don’t copy paste this. Check its integrity
<code><tr class="bodytext">
<td><a class="grayUrl" href='<%# check_Review(DataBinder.Eval(Container.DataItem, "LINK"),DataBinder.Eval(Container.DataItem, "URL"),DataBinder.Eval(Container.DataItem, "SiteName")) %>'</a>
</td>
</tr></code>
code behind....
Private Function check_Review(ByVal link as boolean,ByVal url as string,ByVal sitename as string)
if link then
return "http://" & url & sitename
else
return "#"
end sub
Thomas
|
|
|
|
|
We've just implemented CSS Friendly Control Adapters. We are also using AJAX extensions.
The problem is GridViewAdapter and row's postback. Clicking on a row resuls in "Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true"> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation." I suspect it’s due to there is no method defined, but I don't have any prove. Before we installed the adapter it worked fine. We were binding some java script on each row. First we thought it was something to to with that. But the error remains even after we disable OnRowDataBound.
Bug? Is there a simple way to solve this?
|
|
|
|
|
ASP.NET 2.0
Need to simply process incoming postback information without sending back a reponse.
Client sends HTML from email to a page on a web site. Web Server ASP generates a response page and send it back which opens the browser on the client.
Email body: User Name:
How to avoid sending back the response page.
Just to clarify the language; by the *response* I mean whatever the web server sends back when it receives a transmission that requests it to process a web page. I suppose that any good listener will send back a reply when it receives a request that it can process. Even if a web server is directed to a page that does not exist it will reply something which will open a browser unless a browser with the existing original session or connection is already active.
I confirmed that even an empty server page capable of processing the incoming data will send enough of a message back to open the browser which displays nothing.
A couple of suggestions have been made by forum members such as:
1 - Using a web service
Can a web service be made to accept a form postback data stream as in
My only experience with webservices used a control to shape the message sent to the web service. I have no idea what the message looked like. For all I know the message might look exactly the same as what is being transmitted by the GET package form this email.
The data part of the message was XML which the web service had to process but the encapsulation for the data might have been the same as any message that a web server can respond to.
The web service did send back results. The result did not open a browser but was caught by the control that sent the original message. The control probably operates as a browser with an open web server session. This control browser session received the send back message as IE or any other browser would.
2 - iHttpHandler.
If a page output was redirected to an HttpHandler that did not contain any HTML page component maybe it would not send back a reply?
How would a browser be closed automatically?
Can we close a browser with a message from the web server?
How does a browser end a session? It moves to a different web site or it is closed.
Is there no way for a browser to terminate a session before a web server sends back a response?
Thanks,
RobGMiller
|
|
|
|
|
You just have to handle the response. However you send a request to the server, you will recieve a response, not mainly because the server will always send one, but because the code sending the request always expects the response. Even if the server is never even reached, the mail program will open a browser window to handle the response.
You can use Javascript to close the browser window, but if the browser considers the window to be the main window (which I think it will), the user has to confirm that the window will be closed.
Why do you want to close it anyway? Don't you think that the user wants some kind of confirmation that the information has reached the server?
---
single minded; short sighted; long gone;
|
|
|
|
|
hai every1...am doing a project in asp.net...my project is getting executed correctly in my system but in my coll it shows an error....its not inserting values into the database...the error it shows is
"operation should use an updateable query"
wats this error basically??? can u help me out in rectifying it pls...
|
|
|
|
|
|
|
ASP.NET 2.0
Need to simply process incoming postback information without sending back a reponse.
Client sends HTML from email to a page on a web site. Web Server ASP generates a response page and send it back which opens the browser on the client.
Email body: User Name:
How to avoid sending back the response page.
Just to clarify the language; by the *response* I mean whatever the web server sends back when it receives a transmission that requests it to process a web page. I suppose that any good listener will send back a reply when it receives a request that it can process. Even if a web server is directed to a page that does not exist it will reply something which will open a browser unless a browser with the existing original session or connection is already active.
I confirmed that even an empty server page capable of processing the incoming data will send enough of a message back to open the browser which displays nothing.
A couple of suggestions have been made by forum members such as:
1 - Using a web service
Can a web service be made to accept a form postback data stream as in
My only experience with webservices used a control to shape the message sent to the web service. I have no idea what the message looked like. For all I know the message might look exactly the same as what is being transmitted by the GET package form this email.
The data part of the message was XML which the web service had to process but the encapsulation for the data might have been the same as any message that a web server can respond to.
The web service did send back results. The result did not open a browser but was caught by the control that sent the original message. The control probably operates as a browser with an open web server session. This control browser session received the send back message as IE or any other browser would.
2 - iHttpHandler.
If a page output was redirected to an HttpHandler that did not contain any HTML page component maybe it would not send back a reply?
How would a browser be closed automatically?
Can we close a browser with a message from the web server?
How does a browser end a session? It moves to a different web site or it is closed.
Is there no way for a browser to terminate a session before a web server sends back a response?
Thanks,
RobGMiller
|
|
|
|
|
See my reply to the identical post that you sent less than ten minutes later.
---
single minded; short sighted; long gone;
|
|
|
|
|
I developed a login application in ASP.NET using Visual Studio 2005(C#). It works fine, but when I deploy the same application in a another computer using Visual Web Developer 2005 Express, it doesn't work. It displays the following error message.
"Your login attempt was not successful. Please try again."
As ususal I used the web.config file to list the pages
to which I want have the restricted access and also I used
the Visual Studio's Website -> ASP.NET Configuration tool to add the role and user accounts.
All other data-driven parts are working properly but the
login part is the problem.
Advance thanks.
|
|
|
|
|
Only time I've had this problem is when I changed the applicationName in the web.config. If this is different to when you create the users it won't work.
|
|
|
|
|
I have an application in a Windows forms and I want to export it to a web service.
In my application, there is some initialization done in the constructor of my windows form, as well as in the Load event handler. Obviously, this code executes only once, that is, at the beginning of the program.
I've started to port this application to a Web Service, but I realised that the code in the constructor (where the InitializeComponent is) executes every time I call a function with the Invoke button of the testing interface.
My initialization code is somewhat long and it simply cannot be that way...
Is there a way to make my initialization code execute only once, just like it does in a Windows Form?
Thank you very much!
|
|
|
|
|
haven't done much work with web services but I think they have a Global.asax file much like a web site. Add this to the project (there should be an option for it in the add object dialogue) and it'll generate several methods one of which is Application_Start.
|
|
|
|
|
Hi,
We want to use the resource with the ability to be able to over-write the resource file? Based on maybe an Hierarchy model, set a default resource file but something specified in the Hierarchy should be able to over-write this file to new settings.
We do not want to store this information in the database, creating different languages translations for the data we want to use, and want to take advantage of this .Net framework feature.
Thanks for your time.
|
|
|
|
|
hi
i am doing a website in visual studio 2005.in my asp.net page i have got a grid view which takes the data from the database dynamically.i have given the following code:
protected void GridView1_DataBound(object sender, EventArgs e)
{
int i = ds.Tables[0].Rows.Count;
int j = ds.Tables[0].Columns.Count;
for (int k = 0; k < i; k++)
{
for (int l = 0; l < j; l++)
{
GridView1.Rows[k].Cells[l].Width = new Unit("50px");
}
}
}
i want the output in such a format that i dont want the data in the cell to go to the next line(i.e) it should not wrap the data in a cell. i want only the first 10 characters to appear in my cell and i want the rest to be truncated.i have tried to set wrap to be false also in the source code:
<rowstyle font-size="Medium" wrap="false">
but nothing seems to work. how do i wrap and truncate.
Please help me out. my deadline is nearing.Thanking in advance.
|
|
|
|
|
Can you not just return the first ten characters of the data in your sql statement?
|
|
|
|