Saturday, March 31, 2012
table to list
thanks in advance......
Dim myDB As Database
Dim myRS As dao.Recordset
Dim tdf As TableDef
Private Sub DataList1_Click()
End Sub
Private Sub EXIT_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set myDB = OpenDatabase("C:\deepesh\name.mdb")
Set myRS = myDB.OpenRecordset("details", dbOpenTable)
For Each tdf In myDB.TableDefs
name1.AddItem tdf.name
Next tdf
'If myRS.RecordCount > 0 Then
'myRS.MoveFirst
'End If
If Not myRS.EOF And Not myRS.BOF Then
myRS.MoveFirst
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
myRS.Close
Set myRS = Nothing
myDB.Close
Set myDB = Nothing
End Sub
Private Sub name1_Change()
Set myRS = myDB.OpenRecordset("select name,street1,street2,city,pincode,phone,pan_number from details where name=""& List1.Text &", dbopendybaset)
myRS.FindFirst "[name] = " & name1.Text & """"
If myRS.RecordCount > 0 Then
'If myRS.NoMatch = False Then
phone.Text = myRS("phone")
street1.Text = myRS("street1")
street2.Text = myRS("sreet2")
city.Text = myRS("city")
pincode.Text = myRS("pincode")
pincode.Text = myRS.Fields(5)
End If
Set myRS = Nothing
End Subbut how to add script i don understand i am new to vb so kindly help
You will need to add a bit of javascript to your listbox. Your spectacularly unstructured code makes it a little difficult to look at, but I figure that 'name1' is the name of your listbox. Use .Attributes.Add() to have it call a bit of javascript that populates a textbox on each click event.
Ok, I'll tell you half of it, since you ought to learn.
First, find out the javascript required to populate a textbox whenever an item in a listbox is clicked. Once you find that javascript, in your codebehind, use
name1.Attributes.Add("onClick",yourjavascripthere);
Keep in mind that the exact id of the textbox must be substituted in 'yourjavascripthere'. For this, you can use string concatenation and use textbox1.ClientId to get the client id of the textbox.
i seriously didnt understand a little bit... can we addd script in vb huh???
Yes. In your codebehind, you can dynamically add javascript to one of your controls. For that, you use name1.Attributes.Add().
So for example...
textbox1.Attributes.Add("onClick","alert('hello!');");
Will cause a messagebox to appear when someone clicks on textbox1.
This is ASP.Net forum and not the VB 6 forum. Please ask the moderators to move this thread to Classic VB forum.
Good call. (slaps forehead)
Wednesday, March 28, 2012
TableCell.Text property overwrites dynamic control
property, the hidden control is not output. If I set the text first, then
the hidden control is output but the text is not. No errors are generated.
I can make it work by adding a literal control instead of using the text
property, but why doesn't the "simple" method work?
Dim tCell As TableCell = New TableCell
Dim thidden As HtmlInputHidden = New HtmlInputHidden
thidden.ID = "h1"
thidden.Value = "hidden text"
tCell.Controls.Add(thidden)
tCell.Text = "visible text"
tRow.Cells.Add(tCell)Maybe add the text as a literal?
Joe
"Bob Voss" <bvoss@.Xspam.tsts.com> wrote in message
news:%23iH0xNNxDHA.2408@.tk2msftngp13.phx.gbl...
> If I add a hidden input control to a tablecell and then set the cell's
text
> property, the hidden control is not output. If I set the text first, then
> the hidden control is output but the text is not. No errors are
generated.
> I can make it work by adding a literal control instead of using the text
> property, but why doesn't the "simple" method work?
> Dim tCell As TableCell = New TableCell
> Dim thidden As HtmlInputHidden = New HtmlInputHidden
> thidden.ID = "h1"
> thidden.Value = "hidden text"
> tCell.Controls.Add(thidden)
> tCell.Text = "visible text"
> tRow.Cells.Add(tCell)
Monday, March 26, 2012
Tables inside of forms?
Such as:
<form>
<Table>
<Tr><Td>Company:</Td><Td>TextBoxCompany</Td></Tr>
</Table>
</form
I can not seem to get an insert command to write to the database if I place the text boxes for input in the cells of a table. If I do the same form without the table the insert command works just fine.
What am I missing? Is there a better way to build data collection forms?
Thanks in advance for helping!
Scottyou can use any html you want inside the form.
what error are you taling about, could you be more specific?
Can you show us the textbox declaration and the update code.
Simon
Thanks for responding Christian.
Since I posted I have build a simple form, tested it and then moved the input boxes into a form. And that works as it should.
The project collects employment data for association work. In testing, the application tells me that the post is sucessful, but the record is not written to the database. Because others will use the data in Excel I am using Access 2000.
Here is the code:
Sub ButtonSubmit_Click(sender As Object, e As EventArgs)
Dim Company = Server.HtmlEncode(TextCompany.Text)
Dim FacilityName = Server.HtmlEncode(TextFacilityName.Text)
Dim Address = Server.HtmlEncode(TextAddress.Text)
Dim City = Server.HtmlEncode(TextCity.Text)
Dim State = (DropDownListState.SelectedItem.Value)
Dim FacilityZip = Server.HtmlEncode(TextFacilityZip.Text)
Dim NumberEmployees = Server.HtmlEncode(TextNumberEmployees.Text)
Dim Zip1 = Server.HtmlEncode(TextZip1.Text)
Dim Zip2 = Server.HtmlEncode(TextZip2.Text)
Dim Zip3 = Server.HtmlEncode(TextZip3.Text)
Dim Zip4 = Server.HtmlEncode(TextZip4.Text)
Dim Zip5 = Server.HtmlEncode(TextZip5.Text)
Dim Zip6 = Server.HtmlEncode(TextZip6.Text)
Dim PropertyTaxes = Server.HtmlEncode(TextPropertyTaxes.Text)
Dim WithholdingTaxState = Server.HtmlEncode(TextWithholdingTaxState.Text)
Dim WithholdingTaxFederal = Server.HtmlEncode(TextWithholdingTaxFederal.Text)
Dim CharitableContribution = Server.HtmlEncode(TextCharitableContribution.Text)
Dim UserName = Server.HtmlEncode(TextCharitableContribution.Text)
Dim Pwd = Server.HtmlEncode(TextPassword.Text)
Dim Timestamp As DateTime
Timestamp = Now
InsertRecord(Company, FacilityName, Address, City, State, FacilityZip, _
NumberEmployees, Zip1, Zip2, Zip3, Zip4, Zip5, Zip6, PropertyTaxes, _
WithholdingTaxState, WithholdingTaxFederal, CharitableContribution, _
UserName, Pwd, Timestamp)
End Sub
Function InsertRecord( _
ByVal company As String, _
ByVal facilityName As String, _
ByVal address As String, _
ByVal city As String, _
ByVal state As String, _
ByVal facilityZip As String, _
ByVal numberEmployees As String, _
ByVal zip1 As String, _
ByVal zip2 As String, _
ByVal zip3 As String, _
ByVal zip4 As String, _
ByVal zip5 As String, _
ByVal zip6 As String, _
ByVal propertyTaxes As String, _
ByVal withholdingTaxState As String, _
ByVal withholdingTaxFederal As String, _
ByVal charitableContribution As String, _
ByVal userName As String, _
ByVal pwd As String, _
ByVal timestamp As Date) As Integer
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwr"& _
"oot\Bifma\data\data.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = "INSERT INTO [data] ([Company], [FacilityName], [Address], [City], [State], [Facil"& _
"ityZip], [NumberEmployees], [Zip1], [Zip2], [Zip3], [Zip4], [Zip5], [Zip6], [Pro"& _
"pertyTaxes], [WithholdingTaxState], [WithholdingTaxFederal], [CharitableContribu"& _
"tion], [UserName], [Pwd], [Timestamp]) VALUES (@.Company, @.FacilityName, @.Address"& _
", @.City, @.State, @.FacilityZip, @.NumberEmployees, @.Zip1, @.Zip2, @.Zip3, @.Zip4, @.Zi"& _
"p5, @.Zip6, @.PropertyTaxes, @.WithholdingTaxState, @.WithholdingTaxFederal, @.Charit"& _
"ableContribution, @.UserName, @.Pwd, @.Timestamp)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_company As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_company.ParameterName = "@.Company"
dbParam_company.Value = company
dbParam_company.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_company)
Dim dbParam_facilityName As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_facilityName.ParameterName = "@.FacilityName"
dbParam_facilityName.Value = facilityName
dbParam_facilityName.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_facilityName)
Dim dbParam_address As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_address.ParameterName = "@.Address"
dbParam_address.Value = address
dbParam_address.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_address)
Dim dbParam_city As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_city.ParameterName = "@.City"
dbParam_city.Value = city
dbParam_city.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_city)
Dim dbParam_state As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_state.ParameterName = "@.State"
dbParam_state.Value = state
dbParam_state.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_state)
Dim dbParam_facilityZip As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_facilityZip.ParameterName = "@.FacilityZip"
dbParam_facilityZip.Value = facilityZip
dbParam_facilityZip.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_facilityZip)
Dim dbParam_numberEmployees As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_numberEmployees.ParameterName = "@.NumberEmployees"
dbParam_numberEmployees.Value = numberEmployees
dbParam_numberEmployees.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_numberEmployees)
Dim dbParam_zip1 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip1.ParameterName = "@.Zip1"
dbParam_zip1.Value = zip1
dbParam_zip1.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip1)
Dim dbParam_zip2 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip2.ParameterName = "@.Zip2"
dbParam_zip2.Value = zip2
dbParam_zip2.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip2)
Dim dbParam_zip3 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip3.ParameterName = "@.Zip3"
dbParam_zip3.Value = zip3
dbParam_zip3.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip3)
Dim dbParam_zip4 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip4.ParameterName = "@.Zip4"
dbParam_zip4.Value = zip4
dbParam_zip4.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip4)
Dim dbParam_zip5 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip5.ParameterName = "@.Zip5"
dbParam_zip5.Value = zip5
dbParam_zip5.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip5)
Dim dbParam_zip6 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_zip6.ParameterName = "@.Zip6"
dbParam_zip6.Value = zip6
dbParam_zip6.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_zip6)
Dim dbParam_propertyTaxes As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_propertyTaxes.ParameterName = "@.PropertyTaxes"
dbParam_propertyTaxes.Value = propertyTaxes
dbParam_propertyTaxes.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_propertyTaxes)
Dim dbParam_withholdingTaxState As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_withholdingTaxState.ParameterName = "@.WithholdingTaxState"
dbParam_withholdingTaxState.Value = withholdingTaxState
dbParam_withholdingTaxState.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_withholdingTaxState)
Dim dbParam_withholdingTaxFederal As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_withholdingTaxFederal.ParameterName = "@.WithholdingTaxFederal"
dbParam_withholdingTaxFederal.Value = withholdingTaxFederal
dbParam_withholdingTaxFederal.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_withholdingTaxFederal)
Dim dbParam_charitableContribution As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_charitableContribution.ParameterName = "@.CharitableContribution"
dbParam_charitableContribution.Value = charitableContribution
dbParam_charitableContribution.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_charitableContribution)
Dim dbParam_userName As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_userName.ParameterName = "@.UserName"
dbParam_userName.Value = userName
dbParam_userName.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_userName)
Dim dbParam_pwd As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_pwd.ParameterName = "@.Pwd"
dbParam_pwd.Value = pwd
dbParam_pwd.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_pwd)
Dim dbParam_timestamp As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_timestamp.ParameterName = "@.Timestamp"
dbParam_timestamp.Value = timestamp
dbParam_timestamp.DbType = System.Data.DbType.DateTime
dbCommand.Parameters.Add(dbParam_timestamp)
Dim rowsAffected As Integer = 0
dbConnection.Open
Try
rowsAffected = dbCommand.ExecuteNonQuery
LabelConfirmation.Text = "Thank you! Your data entry was sucessful."
'ButtonSubmit.Enabled = False
Catch
LabelConfirmation.Text = "Sorry there was a problem with your entry. Please Contact Brad or Mike"
'
Finally
dbConnection.Close
End Try
Return rowsAffected
End Function
Thank You for helping.
Scott
Fixed. Appears I had tried to use the reservered word "Timpstamp" as DateTime = Now.
Saturday, March 24, 2012
Tabstrip shows only text
I'm using Visual Studio.NET and I included the tabstrip
inside a custom user control.
In the visual studio editor the tab strip appears correctly
but when running on IE it shows only the text labels.!!!!!!!!
I've placed the dll in the bin directory and the webctrl_client
in the same path with the custom control.Well I must add that it works correctly in Mozilla Firefox!!!!
In IE nothing!
I just thought the control was developed from Microsoft OR NOT ? :)
"Stelios Skiathitis" <sski@.keta-notioaigaio.gr> wrote in message
news:d4l852$s47$1@.usenet.otenet.gr...
> I've downloaded IE Web Controls for ASP.NET
> I'm using Visual Studio.NET and I included the tabstrip
> inside a custom user control.
> In the visual studio editor the tab strip appears correctly
> but when running on IE it shows only the text labels.!!!!!!!!
> I've placed the dll in the bin directory and the webctrl_client
> in the same path with the custom control.
>
>
Stelios:
Any chance you have javascript disabled in IE? Perhaps you are using
IE on server 2003 in a hardened security configuration?
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 26 Apr 2005 14:22:44 +0300, "Stelios Skiathitis"
<sski@.keta-notioaigaio.gr> wrote:
>I've downloaded IE Web Controls for ASP.NET
>I'm using Visual Studio.NET and I included the tabstrip
>inside a custom user control.
>In the visual studio editor the tab strip appears correctly
>but when running on IE it shows only the text labels.!!!!!!!!
>I've placed the dll in the bin directory and the webctrl_client
>in the same path with the custom control.
>
Tabstrip shows only text
I'm using Visual Studio.NET and I included the tabstrip
inside a custom user control.
In the visual studio editor the tab strip appears correctly
but when running on IE it shows only the text labels.!!!!!!!!
I've placed the dll in the bin directory and the webctrl_client
in the same path with the custom control.Well I must add that it works correctly in Mozilla Firefox!!!!
In IE nothing!
I just thought the control was developed from Microsoft OR NOT ? :)
"Stelios Skiathitis" <sski@.keta-notioaigaio.gr> wrote in message
news:d4l852$s47$1@.usenet.otenet.gr...
> I've downloaded IE Web Controls for ASP.NET
> I'm using Visual Studio.NET and I included the tabstrip
> inside a custom user control.
> In the visual studio editor the tab strip appears correctly
> but when running on IE it shows only the text labels.!!!!!!!!
> I've placed the dll in the bin directory and the webctrl_client
> in the same path with the custom control.
Stelios:
Any chance you have javascript disabled in IE? Perhaps you are using
IE on server 2003 in a hardened security configuration?
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 26 Apr 2005 14:22:44 +0300, "Stelios Skiathitis"
<sski@.keta-notioaigaio.gr> wrote:
>I've downloaded IE Web Controls for ASP.NET
>I'm using Visual Studio.NET and I included the tabstrip
>inside a custom user control.
>In the visual studio editor the tab strip appears correctly
>but when running on IE it shows only the text labels.!!!!!!!!
>I've placed the dll in the bin directory and the webctrl_client
>in the same path with the custom control.
Thursday, March 22, 2012
tags in textbox
Hi Im using ASP.NET and C#
and I want to insert tags in a text box but its giving me an error that its a dangerous attempt so can I set any validation to allow that
Hi,
you can use theValidateRequest property to turn that on or off. Be mindfull that this opens your pages for potential hacks though so use with care.
You can also take a look at theAnti Cross Site Scripting library.
Grz, Kris.
Tags Ok In Text of Validator Control?
work:
<asp:requiredfieldvalidator id="valreqUserName" runat="server"
controltovalidate="txtUserName"
errormessage="Please enter the user name">
<span title="Please enter the user name">
<img src="http://pics.10026.com/?src=../../images/bullet.gif">
</span>
</asp:requiredfieldvalidator>
--
John Saunders
Internet Engineer
john.saunders@dotnet.itags.org.surfcontrol.comHi John,
You are right. It's possible to display error using inline error message or
client element.
As an alternative to using the Error Message property for the control, you
can display an error for the control by simply writing it between the open
and close tags for the Validation control. However, unlike the error
Message property, which only supports text-based errors, an inline error
message can contain other client side elements, such as images. Here is a
sample for your reference:
<input type =text id="TextFirstname" value ="Enter First Name" runat
=server
<asp:RequiredFieldValidator
id="RequiredFieldValidator1"
style="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 56px"
ControlToValidate="TextFirstname"
InitialValue="Enter First Name"
display="Dynamic"
runat="server"
<img src="http://pics.10026.com/?src=http://localhost/1.jpg"
</asp:RequiredFieldValidator
I hope this helps.
Best Regards,
Lewis Wang
Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
-------
| From: "John Saunders" <john.saunders@.surfcontrol.com>
| Subject: Tags Ok In Text of Validator Control?
| Date: Wed, 23 Jul 2003 14:13:27 -0400
| Lines: 17
| Organization: SurfControl, Inc.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uJ6rZYUUDHA.2196@.TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: host254wb.surfcontrol.com 65.194.40.254
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:161469
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Is this ok? I haven't seen any examples of it, but it looks like it should
| work:
|
|
| <asp:requiredfieldvalidator id="valreqUserName" runat="server"
| controltovalidate="txtUserName"
| errormessage="Please enter the user name">
| <span title="Please enter the user name">
| <img src="http://pics.10026.com/?src=../../images/bullet.gif">
| </span>
| </asp:requiredfieldvalidator>
| --
| John Saunders
| Internet Engineer
| john.saunders@.surfcontrol.com
|
|
|
Thanks, Lewis. I can see I'll be using this in the future.
I may even create my own derived validator controls, overriding the
ErrorMessage property and adding an ErrorImageUrl property. This would
save me re-typing the error message.
Thanks,
John Saunders
john.saunders@.surfcontrol.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi John ,
Good idea!
Thanks very much for participating the community.
Lewis Wang
Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
-------
| From: John Saunders <john.saunders@.surfcontrol.com>
| References: <5E0F3ZcUDHA.1688@.cpmsftngxa06.phx.gbl>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: RE: Tags Ok In Text of Validator Control?
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <u3hZK8dUDHA.1004@.TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Thu, 24 Jul 2003 05:28:07 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:161705
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks, Lewis. I can see I'll be using this in the future.
|
| I may even create my own derived validator controls, overriding the
| ErrorMessage property and adding an ErrorImageUrl property. This would
| save me re-typing the error message.
|
| Thanks,
| John Saunders
| john.saunders@.surfcontrol.com
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|
Thanks, Lewis. I can see I'll be using this in the future.
I may even create my own derived validator controls, overriding the
ErrorMessage property and adding an ErrorImageUrl property. This would
save me re-typing the error message.
Thanks,
John Saunders
john.saunders@.surfcontrol.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi John ,
Good idea!
Thanks very much for participating the community.
Lewis Wang
Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
-------
| From: John Saunders <john.saunders@.surfcontrol.com>
| References: <5E0F3ZcUDHA.1688@.cpmsftngxa06.phx.gbl>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: RE: Tags Ok In Text of Validator Control?
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <u3hZK8dUDHA.1004@.TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Thu, 24 Jul 2003 05:28:07 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:161705
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thanks, Lewis. I can see I'll be using this in the future.
|
| I may even create my own derived validator controls, overriding the
| ErrorMessage property and adding an ErrorImageUrl property. This would
| save me re-typing the error message.
|
| Thanks,
| John Saunders
| john.saunders@.surfcontrol.com
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|
Take out last character from textbox or label
textbox.
For example:
status.text = "full/part/"
I want to take out the trailing "/".
Thanks,
Tomstring s = "xxx/";
s = s.TrimEnd("/".ToCharArray());
--
Mike
"tshad" <tscheiderich@.ftsolutions.com> wrote in message
news:eegYcvTbFHA.2896@.TK2MSFTNGP10.phx.gbl...
>I am trying to find the best way to delete the last character from a
>textbox.
> For example:
> status.text = "full/part/"
> I want to take out the trailing "/".
> Thanks,
> Tom
Taking out Quotation marks in text.
How can I take Quotation marks ( " ' ) out of a variable before I post it to a database.
The database return errors if I dont take it out.
ThanksUse the SqlParameter of OleDbParameter classes, and the database will not 'give errors'.
A single quote must be replaced by 2x single quote, when used in a query. This is the cause of the errors.
Check this post...
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=317174
good luck sir
Thanks that helped a lot
u can use..
dim str as string
str = Replace(the_text, " ' ", "**")
taking text from a drop down list and want to insert into a database
<%@dotnet.itags.org. Page Language="VB" Debug="true" %>
<%@dotnet.itags.org. import Namespace="System.Data" %>
<%@dotnet.itags.org. import Namespace="System.Data.OleDb" %>
<script runat="server"
dim Conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\admin\Desktop\Reminder\dbReminder.mdb")Sub btnSet_Click(obj as Object, e as EventArgs)
dim objTrans as OleDbTransaction
dim objCmd as OleDbcommand = new OleDbcommand ("INSERT INTO tblReminder (mobile, station, reminder, time) VALUES (@dotnet.itags.org.MOBILE, @dotnet.itags.org.STATION, @dotnet.itags.org.REMINDER, @dotnet.itags.org.TIME)", Conn)
dim objParam as OleDbParameterobjParam = objCmd.Parameters.Add("@dotnet.itags.org.MOBILE", oleDbType.char)
objParam.Direction = ParameterDirection.Input
objParam.Value = lblUser.TextobjParam = objCmd.Parameters.Add("@dotnet.itags.org.STATION", oleDbType.char)
objParam.Direction = ParameterDirection.Input
objParam.Value = lblStation.TextobjParam = objCmd.Parameters.Add("@dotnet.itags.org.REMINDER", oleDbType.Char)
objParam.Direction = ParameterDirection.Input
objParam.Value = DDLFields.SelectedItem.TextobjParam = objCmd.Parameters.Add("@dotnet.itags.org.TIME", oleDbType.char)
objParam.Direction = ParameterDirection.Input
objParam.Value = tbTime.TextConn.Open()
objTrans = Conn.BeginTransaction()
objCmd.Transaction = objTranstry
objCmd.executeNonQuery
objTrans.commit()
catch ex as OleDbException
objTrans.RollBack()
lblError.Text = "Error inserting reminder into database"
end tryobjcmd.Connection.Close()
End subPrivate Sub Page_Load(sender As Object, e As System.EventArgs)
If Not Page.IsPostBack Thendim Conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\admin\Desktop\Reminder\dbReminder.mdb")
dim objTrans as OleDbTransaction
dim objCmd as OleDbcommand = New OleDbCommand("SELECT time + ' ' + programme as fieldone FROM tblRTE ", Conn)
Conn.Open()DDLFields.DataSource = objCmd.ExecuteReader()
DDLFields.DataTextField = "fieldone"
DDLFields.DataValueField = "fieldone"
DDLFields.DataBind()Conn.Close()
End IfIf Not Request.Cookies("rm_user") Is Nothing Then
lblUser.Text = Request.Cookies("rm_user").Value
end if
End Sub</script>
This is the code im using to take the information from the form and enter it into the database.
But it displays my error message every time...
Is it correct?
The part im not sure about is this:
objParam = objCmd.Parameters.Add("@dotnet.itags.org.REMINDER", oleDbType.Char)
objParam.Direction = ParameterDirection.Input
objParam.Value = DDLFields.SelectedItem.Text
Is this the correct way of taking the selected items text from the ddl?
Thanks.Your code looks good, however your SQL looks dodgy. Thisthread in the DevShed forum should help.
I do somthing similar on a page. I think your problem is that the code for the DDL is in the on postback block. When the page is posted back ( user chose something and clicked button to do save) the ddl is not populated.
Try taking the DDL code out of the is postback IF block...
Private Sub Page_Load(sender As Object, e As System.EventArgs)If Not Page.IsPostBack Then
End Ifdim Conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\admin\Desktop\Reminder\dbReminder.mdb")
dim objTrans as OleDbTransaction
dim objCmd as OleDbcommand = New OleDbCommand("SELECT time + ' ' + programme as fieldone FROM tblRTE ", Conn)
Conn.Open()
DDLFields.DataSource = objCmd.ExecuteReader()
DDLFields.DataTextField = "fieldone"
DDLFields.DataValueField = "fieldone"
DDLFields.DataBind()
Conn.Close()
If Not Request.Cookies("rm_user") Is Nothing Then
lblUser.Text = Request.Cookies("rm_user").Value
end if
End Sub
also, I don't think you need the transaction stuff. Transactions are used for multiple DB actions. not a single action. The try block should suffice. If the single DB action fails ( your insert) there are no other actions to rollback.
Hope that helps
> I think your problem is that the code for the DDL is in the on postback block. When the
> page is posted back ( user chose something and clicked button to do save) the ddl is not
> populated. Try taking the DDL code out of the is postback IF block...
This is not the problem. The DDL is repopulated via ViewState on PostBack.
I do agree about the Transaction.
One thing that would help solve this is for emmettd to post the error message.
I talking about the error message in my code.
its "Error inserting reminder into database"
its in the code, in the btnSet_click, near the end.
change this line and let us know what you get
lblError.Text =ex.tostring()
Tuesday, March 13, 2012
TASK MENU
I see on some text a task menu pop up next to a dropdownlist or a grid view for choosing a datasource and setting certain properties. I try but fail to make the task menu appear. Please explain how. Thanks.
In design mode, hover over a control that has quicktasks (datasource,dropdown,etc..)a small triangle appears above the control - click it to open quicktasks
Tb.text = string What Won't transfer?
cell into a textbox in a template cell as follows...
mytb.text = e.item.cells(i).text
my problem/question is that this move does not move all characters. For
instance carriage returns and line feeds don't get moved, and some other non
printable characters don't get moved.
Is there any documentation or rule as to what gets moved and what gets
ingored?
Thanks,
TOf course they don't. ASP:TextBox corresponds to <input type=text>.
That's a single line input, so naturally it only takes the first line
that you stick into it.
Try HtmlTextArea (<textarea runat=server> ) if you want multiline
input.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
no, it just eliminates the characters and picks back up with following
characters. Effectively it "strips" them
T
"Jason Kester" <jasonkester@.gmail.com> wrote in message
news:1130019965.292118.103810@.g44g2000cwa.googlegroups.com...
> Of course they don't. ASP:TextBox corresponds to <input type=text>.
> That's a single line input, so naturally it only takes the first line
> that you stick into it.
> Try HtmlTextArea (<textarea runat=server> ) if you want multiline
> input.
> Jason Kester
> Expat Software Consulting Services
> http://www.expatsoftware.com/
> --
> Get your own Travel Blog, with itinerary maps and photos!
> http://www.blogabond.com/
>
Same effect as far as you're concerned. Be careful of the ASP:Whatever
tags that have a .Text property. They will invariably reformat your
strings to ensure that it gets HtmlEntityEncoded, and often lead to
wacky behavior like you're seeing.
Did switching to Textareas help?
Jason
well, back to my original question...
Is there any documentation or rule as to what gets moved and what gets
ingored?
T
"Jason Kester" <jasonkester@.gmail.com> wrote in message
news:1130022048.185101.202910@.g49g2000cwa.googlegroups.com...
> Same effect as far as you're concerned. Be careful of the ASP:Whatever
> tags that have a .Text property. They will invariably reformat your
> strings to ensure that it gets HtmlEntityEncoded, and often lead to
> wacky behavior like you're seeing.
> Did switching to Textareas help?
> Jason
>
It's not that something will be ignored. Incase, have some "<" / ">",
you'll get a "Potentially dangerous..." exception.
To avoid this, set the property "ValidateRequest = false" in @.Page
directive.
See documentation of "@.Page directive" for more details.
Cheers,
Gaurav Vaish
http://mastergaurav.org
--