|
The name 'Files' does not exist in the current context
|
|
|
|
|
Thank you so much for your help.
I got the answer.
I did not declare file, that's why it shows error. now I'm done.
|
|
|
|
|
Hi,
Struggling at the moment to retrieve an image (I'm successfully putting the image into the database) and place into a webpage - I've done a lot of reading without success.
I've tried things like :-
Dim connection As New SqlConnection(access.SQLstrconn)
Dim command As New SqlCommand("Select additionaldiagram from bluediagram where ID = 24", connection)
connection.Open()
Dim pictureData As Byte() = DirectCast(command.ExecuteScalar(), Byte())
connection.Close()
Dim picture As System.Drawing.Image = Nothing
Using stream As New IO.MemoryStream(pictureData)
picture = System.Drawing.Image.FromStream(stream)
Image1 = picture
End Using
To no avail
Any help would be most appreciated
|
|
|
|
|
|
Thank you, I'll have a read
|
|
|
|
|
That's c# anyone got a vb example ?
|
|
|
|
|
|
I got the source code but there is no output coming out.
there is no any error too. can you please help me..
This is the source code I used in asp:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" style="z-index: 1; left: 420px; top: 315px; position: absolute; width: 285px; height: 22px" />
<asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick ="UploadMultipleFiles" accept ="image/gif, image/jpeg, file/exe" style="z-index: 1; left: 420px; top: 341px; position: absolute" />
<hr />
<asp:Label ID="lblSuccess" runat="server" ForeColor ="Red" style="z-index: 1; left: 518px; top: 344px; position: absolute" />
c#:
foreach (HttpPostedFile postedFile in FileUpload1.PostedFiles)
{
string fileName = Path.GetFileName(postedFile.FileName);
postedFile.SaveAs(Server.MapPath("~/Uploads/") + fileName);
}
lblSuccess.Text = string.Format("{0} files have been uploaded successfully.", FileUpload1.PostedFiles.Count)
|
|
|
|
|
file/exe is not the MIME type for executable files. It will most likely come through as application/octet-stream , but it depends on the browser and the client OS.
NB: Uploading executable files to the web server is rather dangerous. If you haven't configured your server properly, there's a possibility that the uploaded file could be executed on your server, which would be a major security vulnerability.
How to configure uploads for IIS Web applications[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for your kind info.
This is my company requirement to do so. I will discuss about it with the authority person.
Thank You
|
|
|
|
|
We can use imageUrl to display images in treeview. My images are stored in SQL database as images. How can we display the image from database in treeview?
|
|
|
|
|
Create a Generic handler to return the image from sql.
Here is a simple example:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim id As String = context.Request.QueryString("imageID")
Dim MyImage as Byte()
context.Response.ContentType = "image/png"
context.Response.BinaryWrite(MyImage)
End Sub
And your imageurl will be GenericHandler.ashx?imageID=...
|
|
|
|
|
|
foreach (GridViewRow row in GridView_pm.Rows)
{
if (row.Cells["MachineTypeNo"].Value.ToString().Equals(txt_search.Text))
{
GridView_pm.Rows[row.Index].DefaultCellStyle.BackColor =("yellow");
}
else
{
GridView_pm.Rows[row.Index].Visible = false;
}
I don't really sure about it..can you pls help me.
|
|
|
|
|
You should write the code in row data bound event of the gridview. The following code will change the value of the corresponding row to yellow color.
protected void GridView_pm_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (!String.IsNullOrWhiteSpace(txt_search.Text))
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var rowView = e.Row.DataItem as DataRowView;
if (String.Compare(rowView["MachineTypeNo"].ToString(), txt_search.Text,true) == 0)
{
e.Row.BackColor = System.Drawing.Color.Yellow;
}
else
{
e.Row.BackColor = System.Drawing.Color.White;
}
}
}
}
Thanks & Regards
Taleeb
(trystwithdotnet.blogspot.com)
modified 29-Sep-15 4:01am.
|
|
|
|
|
Thank you for your sharing..
|
|
|
|
|
<asp:ImageButton ID="imgbtn_search" runat="server" BorderStyle="Solid" ImageUrl="~/images/search.png" style="height: 28px; position: relative; top: 11px; left: 934px; width: 30px;" OnClick="imgbtn_search_Click1"/>
<asp:TextBox ID="txt_search" placeholder="search by Machine and DD/MM/YYYY " runat="server" style="z-index: 1; left: 682px; top: 20px; position: absolute; width: 237px; bottom: 271px"></asp:TextBox>
modified 28-Sep-15 4:08am.
|
|
|
|
|
Simple, it submits your data. The "another page" would be the page where your form has to land after submission. Preventing the user from submitting a form via Enter key, is a bad UX, in my opinion. User would want to use keyboard for the submission process and you would be preventing him from doing so.
I have never used ASP.NET Web Forms, but I do know that even that form gets translated to HTML while rendering, so you can control that via JavaScript. Following script would suffice.
$('input[type="text"]').keydown(function (e) {
if(e.which == 13) {
return false;
}
});
This would do the trick for you, but I would suggest that you do not do so. Let user submit the form using Enter key.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thank you soo much for your kind answer.
what I actually mean is I created a search button. when I search for the result and press on ENTER, its going to default page. when I manually click on search button its showing the result.
|
|
|
|
|
We can't say from what you've posted. When you press enter in a textbox the first button of the form is clicked. So you'll need to find the first button on your form and try and work out from that what is happening. It could be clicking that button is activating js or something, we don't know.
|
|
|
|
|
Thank you soo much for your kind answer.
what I actually mean is I created a search button. when I search for the result and press on ENTER, its going to default page. when I manually click on search button its showing the result.
|
|
|
|
|
|
I tried that too, its work. Now the problem is I have 3 buttons in 1 panel. There are search, submit and log out. for the submit button I created as once insert data and click on submit button it will go to another page but when I use defaultbutton its remaining on the same page. because of that I did not use defaultbutton in panel.
Thank you
|
|
|
|
|
HI,
I want to know that,
What is the important of ISPostBack in asp.net???
Can AnyOne help???
|
|
|
|
|