Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Monday, March 26, 2012

Populate a Password Textbox from DB

Hello,

I have a query that populates several textboxes on my page.

I have a textbox called tboxPassword and it's type is set to password.

The the query runs, the Password box is left empty. I'm assuming this is some feature of the 'password' type assigned to the box. Is there anyway to overcome this? It's ok if the password still appears as ****, but I'd like it to be in the boxes.

Thanks!
Jason<input type="password" value="PASSWORDHERE" /
<asp:textbox TextMode="password" text="blahblahblah" runat="server" /
In either case, the password will appear as ****, but the underlying HTML (viewable through a simple "View Source") will show the password in plain text. In otherwords, you lose any and all password security by doing this and you shouldnot do it.
Actually, you cannot populate a password textbox from code. Even if you try to assign it a value, hoping it will appear as ****, it will not work.

As pickyh3d said, you shouldn't want to do this.

You can't do it anyway.
heh woops. I never tried it, so I just figured it would work... you could cheat and hard code it into an input tag, but you still shouldn't.

Learn something new everyday.

Populate datagrid from XML file using where type query

I am able to populate a datagrid from an XML variable using the
following:
Try
Dim ds As New DataSet
ds.ReadXml(New
StringReader(HttpContext.Current.Application("var").ToString))
dataMeet.DataSource = ds
dataMeet.DataBind()
Catch ex As Exception
error_email.fncErrorHandler(ex)
lblError.Text = ex.ToString
End Try
however this does not allow me to use a sql type query to select
exactly the data I want in the datagrid.
The query I am looking to achieve is actually very simple, just a
simple 'where' but I have no idea how to achieve this when binding to
an xml variable
The sql query and a sample xml file are pasted below:
select TITLE, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME, DEPT, EMAIL,
PHONE FROM DATABASE.TABLE "
WHERE MEMBERTYPE_CODE = 'MEM' ORDER BY MEMBER_ID
<NewDataSet>
<Table>
<MEMBERTYPE_CODE>OFF</MEMBERTYPE_CODE>
<LAST_NAME>Smith</LAST_NAME>
<FIRST_NAME>Harry</FIRST_NAME>
<TITLE>engineer</TITLE>
<DEPT>engineering</DEPT>
<EMAIL>harry.smith@dotnet.itags.org.email.address</EMAIL>
<PHONE>(111) 111-1111</PHONE>
</Table>
<Table>
<MEMBERTYPE_CODE>MEM</MEMBERTYPE_CODE>
<LAST_NAME>fred</LAST_NAME>
<FIRST_NAME>bloggs</FIRST_NAME>
<TITLE>Webmaster</TITLE>
<DEPT>Information Technology Services</DEPT>
<EMAIL>fred.blogs@dotnet.itags.org.email.address</EMAIL>
<PHONE>(111) 111-1112</PHONE>
</Table>
</NewDataSet>
Thank you for your timePerfect, just what I needed!
Thank you

Populate datagrid from XML file using where type query

I am able to populate a datagrid from an XML variable using the
following:

Try
Dim ds As New DataSet
ds.ReadXml(New
StringReader(HttpContext.Current.Application("var").ToString))
dataMeet.DataSource = ds
dataMeet.DataBind()
Catch ex As Exception
error_email.fncErrorHandler(ex)
lblError.Text = ex.ToString
End Try

however this does not allow me to use a sql type query to select
exactly the data I want in the datagrid.

The query I am looking to achieve is actually very simple, just a
simple 'where' but I have no idea how to achieve this when binding to
an xml variable

The sql query and a sample xml file are pasted below:

select TITLE, FIRST_NAME || ' ' || LAST_NAME AS FULL_NAME, DEPT, EMAIL,
PHONE FROM DATABASE.TABLE "
WHERE MEMBERTYPE_CODE = 'MEM' ORDER BY MEMBER_ID

<NewDataSet>
<Table>
<MEMBERTYPE_CODE>OFF</MEMBERTYPE_CODE>
<LAST_NAME>Smith</LAST_NAME>
<FIRST_NAME>Harry</FIRST_NAME>
<TITLE>engineer</TITLE>
<DEPT>engineering</DEPT>
<EMAIL>harry.smith@dotnet.itags.org.email.address</EMAIL>
<PHONE>(111) 111-1111</PHONE>
</Table>
<Table>
<MEMBERTYPE_CODE>MEM</MEMBERTYPE_CODE>
<LAST_NAME>fred</LAST_NAME>
<FIRST_NAME>bloggs</FIRST_NAME>
<TITLE>Webmaster</TITLE>
<DEPT>Information Technology Services</DEPT>
<EMAIL>fred.blogs@dotnet.itags.org.email.address</EMAIL>
<PHONE>(111) 111-1112</PHONE>
</Table>
</NewDataSet
Thank you for your timeHi gn,

You can use DataView's properties RowFilter and Sort to
perform functionality similar to 'WHERE' condition
and 'ORDER BY' in sql query. Following is sample code
snippet:

Dim dv As DataView = ds.Tables(0).DefaultView
dv.RowFilter = "MEMBERTYPE_CODE = 'MEM'"
dv.Sort = "LAST_NAME"
dataMeet.DataSource = dv
dataMeet.DataBind()

HTH

Elton Wang
elton_wang@.hotmail.com

>--Original Message--
>I am able to populate a datagrid from an XML variable
using the
>following:
> Try
> Dim ds As New DataSet
> ds.ReadXml(New
>StringReader(HttpContext.Current.Application
("var").ToString))
> dataMeet.DataSource = ds
> dataMeet.DataBind()
> Catch ex As Exception
> error_email.fncErrorHandler(ex)
> lblError.Text = ex.ToString
> End Try
>however this does not allow me to use a sql type query to
select
>exactly the data I want in the datagrid.
>The query I am looking to achieve is actually very
simple, just a
>simple 'where' but I have no idea how to achieve this
when binding to
>an xml variable
>The sql query and a sample xml file are pasted below:
>select TITLE, FIRST_NAME || ' ' || LAST_NAME AS
FULL_NAME, DEPT, EMAIL,
>PHONE FROM DATABASE.TABLE "
>WHERE MEMBERTYPE_CODE = 'MEM' ORDER BY MEMBER_ID
><NewDataSet>
> <Table>
> <MEMBERTYPE_CODE>OFF</MEMBERTYPE_CODE>
> <LAST_NAME>Smith</LAST_NAME>
> <FIRST_NAME>Harry</FIRST_NAME>
> <TITLE>engineer</TITLE>
> <DEPT>engineering</DEPT>
> <EMAIL>harry.smith@.email.address</EMAIL>
> <PHONE>(111) 111-1111</PHONE>
> </Table>
> <Table>
> <MEMBERTYPE_CODE>MEM</MEMBERTYPE_CODE>
> <LAST_NAME>fred</LAST_NAME>
> <FIRST_NAME>bloggs</FIRST_NAME>
> <TITLE>Webmaster</TITLE>
> <DEPT>Information Technology Services</DEPT>
> <EMAIL>fred.blogs@.email.address</EMAIL>
> <PHONE>(111) 111-1112</PHONE>
> </Table>
></NewDataSet>
>Thank you for your time
>.
Perfect, just what I needed!

Thank you

Friday, March 16, 2012

Populating a List Box

Hi

I am trying to populate a list box with all my themes that i have created but I keep getting an message which is

Type DirectoryInfo is not defined i m guessing i have to declare if but i dont know how are where please could you guys help. Thanks

1Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)23If (Not Page.IsPostBack)Then45 Dim themeDirAs New DirectoryInfo(Server.MapPath("App_Themes"))6 lstThemes.DataTextField ="Name"7 lstThemes.DataSource = themeDir.GetDirectories()8 lstThemes.DataBind()910End If1112 End Sub13

The DirectoryInfo class is located under the System.IO namespace.


Yeah i tired declaring it as Inherits System.IO. Is that the correct appraoch


hello i ve tried to use the system io like u suggested but i still have the same problem here s my code. Do u have any ideas where i am going wrong cheers

PartialClass _Default

Inherits System.Web.UI.Page

Inherits System.IO

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)

If (Not Page.IsPostBack)Then

Dim themeDirAsNew DirectoryInfo(Server.MapPath("App_Themes"))

lstThemes.DataTextField ="Name"

lstThemes.DataSource = themeDir.GetDirectories()

lstThemes.DataBind()

EndIf

EndSub

EndClass


Is your App_Thems directory in your web directory? I would check the path returned by Server.MapPath("App_Theme"), perhaps it doesn't exists and that's why you're getting an error.

bigyawn_hippo:

hello i ve tried to use the system io like u suggested but i still have the same problem here s my code. Do u have any ideas where i am going wrong cheers

PartialClass _DefaultInherits System.Web.UI.Page

Inherits System.IO

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)

If (Not Page.IsPostBack)Then

Dim themeDirAsNew DirectoryInfo(Server.MapPath("App_Themes"))

lstThemes.DataTextField ="Name"

lstThemes.DataSource = themeDir.GetDirectories()

lstThemes.DataBind()

EndIf

EndSub

EndClass

Hi,

Based on my understanding, you want to import the System.IO namespace in your asp.net VB application. If I have misunderstood you, please feel free to let me know.

The DirectoryInfo class is in the System.IO. If we want to use it, we can import it. For example:

Imports System.IOPartialClass _DefaultInherits System.Web.UI.PageProtected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)If (Not Page.IsPostBack)Then Dim themeDirAs New DirectoryInfo(Server.MapPath("App_Themes")) lstThemes.DataTextField ="Name" lstThemes.DataSource = themeDir.GetDirectories() lstThemes.DataBind()End If End SubEnd Class

Alternatively, we can use this namespace in the code behind directly, for example:

Dim themeDir As NewSystem.IO.DirectoryInfo(Server.MapPath("App_Themes"))

Besides, you can find more information about asp.net by the following link:http://www.asp.net/get-started/.


I hope this helps.


Hi hyppo,

why don't you try to put only this two instructions ?

lstThemes.DataSource = themeDir.GetDirectories()
lstThemes.DataBind()

I found my code doing the same and i didn' t write ...DataTextField