|
You should create two public properties or methods for accessing those textboxes in User Control. then, it will be more easier to access those values from UI developer's side..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
i am not getting the user defined controll
when i use
ASP.usercontroll cont=(ASP.usercontroll)PreviousPage.FindControl("usercontroll");
i get the exception refrnce not set to an instance of an object
|
|
|
|
|
Are you the one who create this user-defined control? (Are you a component developer or UI developer?)
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I need help how upload pdf file.
Sohail Ali
|
|
|
|
|
Suhail Ali wrote:
I need help how upload pdf file.
File upload control ?
|
|
|
|
|
|
It's simple:
just use the following ready-to-run code snippets, passing in your File Field control as an argument. Each function will return just the information you want to feed straight into your database, from a byte array for the image field to a string for the file type.
Public Function GetByteArrayFromFileField( _
ByVal FileField As System.Web.UI.HtmlControls.HtmlInputFile) _
As Byte()
' Returns a byte array from the passed
' file field controls file
Dim intFileLength As Integer, bytData() As Byte
Dim objStream As System.IO.Stream
If FileFieldSelected(FileField) Then
intFileLength = FileField.PostedFile.ContentLength
ReDim bytData(intFileLength)
objStream = FileField.PostedFile.InputStream
objStream.Read(bytData, 0, intFileLength)
Return bytData
End If
End Function
Public Function FileFieldType(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As String
' Returns the type of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return FileField.PostedFile.ContentType
End Function
Public Function FileFieldLength(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As Integer
' Returns the length of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return FileField.PostedFile.ContentLength
End Function
Public Function FileFieldFilename(ByVal FileField As _
System.Web.UI.HtmlControls.HtmlInputFile) As String
' Returns the core filename of the posted file
If Not FileField.PostedFile Is Nothing Then _
Return Replace(FileField.PostedFile.FileName, _
StrReverse(Mid(StrReverse(FileField.PostedFile.FileName), _
InStr(1, StrReverse(FileField.PostedFile.FileName), "\"))), "")
End Function
SSK.
|
|
|
|
|
here's a tip (C#)
Dim theFullyQualifiedPath As System.String = ""
Dim Dir as System.String = ""
theFullyQualifiedPath = Me._root_path & "\" & System.IO.Path.GetFileName(Me.FileUpload.PostedFile.FileName)
Dir = "the directory on the site(url)"
Dim strFileName as string
strFileName = FileUpload.PostedFile.FileName
Dim strFile as string
strFile = System.IO.Path.GetFileNameWithoutExtension(strFileName)
Dim strExtension as string
strExtension = System.IO.Path.GetExtension(strFileName)
Dim FullPath as string
FullPath = Dir & strFile & strExtension
hope this helps...
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
HI Guys,
Im having trouble converting the value of the Texbox(string) to Integer. Here is my code:
Dim TSF as Double
Dim txtemailid as Textbox
if (IsPostBack) then
For Each i in dbgInbox.Items
txtemailid = i.FindControl("txttsf")
TSF = txtemailid.Text
if (TSF = 1) then
lbl1.Text = "one"
else
lbl1.Text = "two"
end if
Next
end if
I also tried using
TSF = Convert.ToInt32(txtemailid.Text) - error was "Input String was not in a correct format"
and the other one
TSF = Int.Parse(txtemailid.Text) - error was "Overload resolution failed because no accessible 'Int' accepts this number of arguments"
Anyone who can help on this?
Thanks a lot..
-bryan
|
|
|
|
|
try this code
TSF =Convert.ToInt32(txtemailid.Text)
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Hi Pathan,
I already tried it, but when I tried to enter a number on the Textbox, the error I received was "Input String was not in a correct Format".
any other options??
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
I think i.FindControl("txttsf") returns NULl.
check it first.
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
No. I tried to enter a string like the word "one" and it displayed on the label the word one, as it says on the condition statements. But when I tried to enter a number, the problem now occurs.
regards
bryan
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
Ok now Check it
Dim out As Integer<br />
If Integer.TryParse(txtemailid.Text, out) = True Then<br />
Response.Write("Done")<br />
else<br />
Response.Write("Failed")<br />
End If
//Input values must be an Intger
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Here's the result:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'TryParse' is not a member of 'Integer'.
Source Error:
Line 170: Dim out As Integer
Line 171: If Integer.TryParse(txtemailid.Text, out) = True Then
Line 172: Response.Write("Done")
Line 173: else
I also tried using Int.TryParse but this error occured "Overload resolution failed because no accessible 'Int' accepts this number of arguments."
regards
bryan
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
'TryParse' is not a member of 'Integer'.
Ok try with System.Int32
Best regard
Pathan
---------------------------------------------------
|
|
|
|
|
the same error occured, TryParse is not a member of Integer.
I tried using this code:
For Each i in dbgInbox.Items
txtemailid = i.FindControl("txttsf")
Dim out As Integer
If Integer.Parse(txtemailid.Text, out) = True Then
Response.Write("Done")
else
Response.Write("Failed")
End If
Next
when I entered a number on the Textbox, the error "Input string was not in a correct format" appeared.
maybe i just missed a code in here... "If Integer.Parse(txtemailid.Text, out) = True Then"
regards
bryan
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
"If Integer.Parse(txtemailid.Text, out) = True Then " is wrong bcoz
Integer.Parse does not return bool.
Use Integer.TryParse if u got "TryParse is not a member of Integer. " this error then try with this System.Int32.TryParse
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Which verson of .Net r u using?
Best Regard
Patha
---------------------------------------------------
|
|
|
|
|
I hate this coding because i'm coding inside the code not the codebehind.
I'm using 1.1 version
-bryan
<div class="ForumSig">--- If the facts don't fit the Theory, change the facts...</div>
|
|
|
|
|
hi... the same error occurs..
--- If the facts don't fit the Theory, change the facts...
|
|
|
|
|
You can not use TryParse method in 1.1
Sorry
Pathan
---------------------------------------------------
|
|
|
|
|
Hi,
I have a Gridview which contain the 2 columns first column is textbox: ID and second column is the Label for Name. Initially I am loading data into the Gridview from database and the Textbox for ID is in editable mode only. With one save button click I am updating all rows into database.
And one Add button which is outside the Gridview. When the user clicks on the Add I am inserting row to the Gridview. The user enter some value into the textbox ID I need to validate the ID entered If the ID is valid I need to populate the Correspoing name into Name label.
1)Which event I need to fire for Gridview to validate the TextBox entry, Textbox focus lost I need to check the entered ID.
2)If the user changes the ID of the row which Gridview got from Database. Here also I need to validate the Id and populate name for the corresponding ID.
Here my question is which I need to fire for Gridview which need to be fired for the ID text box loosing the focus.
Thanks in advance
|
|
|
|
|
AFAIK, there is only javascript event that can be fired after loosing the focus. So, if your validation function is a server-side function, you can't invoke this from client-script unless you are using Ajax.
So, I think that the sample way would be validating the input when the user click "Add" button instead of checking after loosing the focus......
It is just my idea. We can listen what other members say about that..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
hi everyone
i want anyone help me to make simple code which make search in dataBase and return the words which found in the the text of database with yelow color or any color ..how i do something like this (ASP.NET with C#) ?
thanks in advance
|
|
|
|