|
i am developing a web based application
where i use
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
<column><asp:templatefield>
<itemtemplate>
function getdata(obj)
{
var txt = document.getElementById(obj);
txt.value='0';
}
i want to pass textbox ID which is in a grid view to the java script.
how it can be possible
Thanks & Regards
Sourav Ghosh
|
|
|
|
|
generally text box is used to edit item in edit mode..
so find that text box in row editing
now attach txtboxid.attribute.add("onkeypress","return getdate(this);");
i think this will help u....
|
|
|
|
|
I had a problem with my User Control write by VB Code
when i apply this control to my Web form and try to set the focus. i get a error Message "cbCustomerID is NULL or not an Object"
here this some of the Web Form code:
ASPX:
<![CDATA[<%@ Page Language="vb" codebehind="InvoiceHeaderDetail.aspx.vb" autoeventwireup="false" Inherits="EnterpriseASP.InvoiceHeaderDetail" ><br />
<%@ Register TagPrefix="cc1" Namespace="EnterpriseASP" Assembly="PopupControl" %>]]>
<cc1:popupcontrol id="cbCustomerID1" tabindex="6" runat="server" cssclass="fieldeditor" width="80%" autopostback="True" targeturl="../../EnterpriseASPAR/CustomerInformation/CustomerInformationLookup.aspx" xmlns:cc1="#unknown"></cc1:popupcontrol>
VB Code Behind:
RegisterStartupScript("focus", "<script language="" javascript="">" & vbCrLf & _<br />
vbTab & "document.all." & cbCustomerID1.ClientID & ".focus();" & _<br />
vbCrLf & "<" & "/script>")</script>
anybody has any idea why this happening and how to resolve?
modified on Wednesday, July 30, 2008 3:05 AM
|
|
|
|
|
Please help me to resolve. if required any addtional info please tell me. thank you in advance
|
|
|
|
|
Hi,
I m trying to use http://www.dimebrain.com/2007/07/a-dual-slider-f.html[^]
dual slider control in asp.net c# project.
When I add this control to my project it replaces the previous dll of ajax that I have installed.So i m not able to use the default ajax controls.
any suggestion how I can use both of them together??
Vijay V.
Yash Softech
|
|
|
|
|
hai all,
i am using .net 2005.i do my project in asp.net webapplication.
i write the connection named as "connstring_card" in web.config using xml.
i done the following code in web.config using xml.
<appSettings>
<add key="connstring_card" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Kantech\Server_SE\Data;Extended Properties=Paradox 5.x;"/>
</appSettings>
then i access that connection named as "connstring_card" in c# coding side from web.config.
The following code done in c# coding side.
string conn = ConfigurationSettings.AppSettings["connstring_card"];
con = new OleDbConnection(conn);
con.Open();
com = new OleDbCommand("select CardInfo1 from Card where State=1", con);
dr = com.ExecuteReader();
the error "External table is not in the expected format." are showed in the line dr=com.executereader().
how to solve this?
|
|
|
|
|
sathyan_8294 wrote: the error "External table is not in the expected format." are showed in the line dr=com.executereader().
how to solve this?
Search in google with error text "External table is not in the expected format". You will give reason why this error cause.
please don't forget to vote on the post that helped you.
|
|
|
|
|
Everybody want code or perfect solution.Nobody wants to try yourself.
Dude I have searched in google and I have found a lots of reason thats why I told you to search in google.You needn't to avoid this answer.
Believe me if you search in google you can solve this problem in a minute.
please don't forget to vote on the post that helped you.
|
|
|
|
|
I gave your post a 5. This forum depresses me far too often....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: I gave your post a 5.
Thanks CG.
please don't forget to vote on the post that helped you.
|
|
|
|
|
The guy you 1 voted had it right. If you were to use google, you'd get heaps of info on this. Seeing as you're too lazy, I did it for you. Here's the answer I found.
"that usually indicates that the default sort order in Pdox and Access are different, and the Pdox table you're trying to touch is keyed (indexed)"
Imagine how much work you could achieve if you were willing to search for yourself ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hey Dude,
Declare the oledb Connection Object Like This.
OleDbConnection cn=new OleDbConnection(ConfigurationManager.ConnectionStrings["connstring_card"].ConnectionString;
may be it will helpful to you...
|
|
|
|
|
1) He's clearly not defined his conn string in the ConnectionStrings element in his web config - he's defined it in appSettings
2) Your code snippet would not compile, it's missing a closing parenthesis.
|
|
|
|
|
Hi,
I am using MasterPages in my project. It is working fine.
In some child pages MasterPage content(Images, MenuControl) is not visible. ChildPage Content() is overriding the masterPage content.........How to Avoid?
How to move the Content)control in child page?
Note: Most of the pages it is looking good but int two or three pages it is happening...
Thanking you
McMilan.
|
|
|
|
|
Hi there,
I'm having a pretty serious problem with file uploads not working on my live site. I was able to upload fine when I was testing in VS on my local machine.
When I try to upload a file I'm getting the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
I'm using an aspnet fileupload control and my code is as following:
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
If photoFileUpload.PostedFile Is Nothing Then
lblMessage.Text = "No file specified."
Exit Sub
Else
Dim FileName As String = photoFileUpload.PostedFile.FileName
All my following code requires FileName to be accurate. So i'm 100% sure my problem is on that last line.
I've tried using System.IO.Path.GetFullPath but that doesn't seem to be helping.
Any ideas would be really helpful.
Many Thanks
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
JimBob SquarePants wrote: Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
The path here refer to the client machine path. It doesn't matter. Where you are trying to upload? I meant the server's location at which the uploaded files are stored.
|
|
|
|
|
I'm actually uploading an image file directly onto a database. I can edit that database so I have appropriate access. It's just an image file from my local computer. I'm sure i've just missed out something to tell the server to look on the users computer.
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
R u storing only Image full path in database or complete file??????
Because if u r storing only path, then while u retrive server reads pathe as C://.......... and tries to find that file in server's C://, and file is obviously not their. .. so its giving FileNotFound Exception I guess....
Tell me what u r doing???
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Definitely you are missing something. Post your uploading code. Will try to find out the problem.
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Ok Firstly I'll give you all a quick runthrough of what I'm doing.
Essentially I'm Identifing the file, loading and resizing it in memory and producing a System.Data.Linq.Binary object that is uploaded to my database.
All this works when I'm running the website on my local machine. The live version can't find the file.
Here Goes:
'----------------------------------------------------------------------------------
' Name : btnAddPhoto_Click
' Purpose : This event handles the Conversion of the uploaded image files to System Data Linq Binary.
'----------------------------------------------------------------------------------
Protected Sub btnAddPhoto_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles btnAddPhoto.Click
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
If photoFileUpload.PostedFile Is Nothing Then
lblMessage.Text = "No file specified."
Exit Sub
Else
Dim FileName As String = photoFileUpload.PostedFile.FileName
Dim ext As String = FileName.Substring(FileName.LastIndexOf("."))
ext = ext.ToLower
If ext = ".jpg" Then
ElseIf ext = ".bmp" Then
ElseIf ext = ".gif" Then
ElseIf ext = "jpg" Then
ElseIf ext = "bmp" Then
ElseIf ext = "gif" Then
Else
lblMessage.Text = "Only gif, bmp, or jpg format files supported."
Exit Sub
End If
' convert the fileupload.postedfile to system.data.linq.binary
Dim source As FileInfo = New FileInfo(FileName)
Dim buffer() As Byte = New Byte(photoFileUpload.PostedFile.ContentLength - 1) {}
source.OpenRead.Read(buffer, 0, photoFileUpload.PostedFile.ContentLength)
buffer = ResizeImageFile(buffer, 200)
crpImage1 = New System.Data.Linq.Binary(buffer)
lblMessage.Text = "Image Successfully Uploaded."
End If
End Sub
ResizeImageFile refers to this:
Public Shared Function ResizeImageFile(ByVal imageFile() As Byte, ByVal targetSize As Integer) As Byte()
Using oldImage As System.Drawing.Image = System.Drawing.Image.FromStream(New MemoryStream(imageFile))
Dim newSize As Size = CalculateDimensions(oldImage.Size, targetSize)
Using newImage As Bitmap = New Bitmap(newSize.Width, newSize.Height, PixelFormat.Format24bppRgb)
Using canvas As Graphics = Graphics.FromImage(newImage)
canvas.SmoothingMode = SmoothingMode.AntiAlias
canvas.InterpolationMode = InterpolationMode.HighQualityBicubic
canvas.PixelOffsetMode = PixelOffsetMode.HighQuality
canvas.DrawImage(oldImage, New Rectangle(New Point(0, 0), newSize))
Dim m As New MemoryStream
newImage.Save(m, ImageFormat.Jpeg)
Return m.GetBuffer
End Using
End Using
End Using
End Function
Calculate Dimensions to this:
Public Shared Function CalculateDimensions(ByVal oldSize As Size, ByVal targetSize As Integer) As Size
Dim newSize As Size
If (oldSize.Height > oldSize.Width) Then
newSize.Width = CType((oldSize.Width * CType((targetSize / CType(oldSize.Height, Single)), Single)), Integer)
newSize.Height = targetSize
Else
newSize.Width = targetSize
newSize.Height = CType((oldSize.Height * CType((targetSize / CType(oldSize.Width, Single)), Single)), Integer)
End If
Return newSize
End Function
Hope this clears everything up.
Thanks in advance!
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
JimBob SquarePants wrote: ' convert the fileupload.postedfile to system.data.linq.binary Dim source As FileInfo = New FileInfo(FileName) Dim buffer() As Byte = New Byte(photoFileUpload.PostedFile.ContentLength - 1) {}
This is very wrong way of getting the bytes of uploaded file. What you are trying is, you are getting the filename and trying to get the bytes of invalid file in the server.
Dim FileSize As Integer = 0
FileSize = fileUpload.PostedFile.ContentLength
Dim FileData(FileSize) As Byte
fileUpload.PostedFile.InputStream.Read(buffer, 0, FileSize)
Now you will get the bytes of the selected file.
modified on Wednesday, July 30, 2008 7:12 AM
|
|
|
|
|
My fingers were well and truly crossed then. Sadly no luck.
Dim source As FileInfo = New FileInfo(FileName )
I wasn't happy with that part of the code. I'm pretty much a beginner so I'm sure there are a few more bits in there that could do with an overhaul.
Could there be a problem with the way the stream is read from my computer from the server e.g should "\" be "/"??
Thanks so far!
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
As I told you before you are trying to get the bytes of a file from the user's machine in the server's location.
Rather, FileUpload control automatically provides the bytes using a simple function call like fileUpload1.PostedFile.InputStream.Read(arg1, arg2, arg3) (refer my previous post for the code).
|
|
|
|
|
Ok this is what I have done so far. It's still giving me the same error.
Thanks for staying with me so far.
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
Dim myfile As HttpPostedFile = photoFileUpload.PostedFile
Dim FileSize As Integer = 0
FileSize = myfile.ContentLength
Dim FileData(FileSize) As Byte
myfile.InputStream.Read(FileData, 0, FileSize)
FileData = ResizeImageFile(FileData, 200)
crpImage1 = New System.Data.Linq.Binary(FileData)
What am i doing wrong?
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
That is it. Now it should be all set, I believe.
|
|
|
|