adsense

Monday, April 25, 2016

Bootstrap layout generator

Since twitter introduced BootStrap, there has been plenty of resources that aid in building bootstrap layouts. Now the developers simply can try one of free online layout builders and generate the layout online.
This article discusses some of the available online bootstrap layout generators and I found layoutit to be very use full.

Cheers,
Samitha


Tuesday, April 12, 2016

ASP.Net keep textbox passoword on postbacks

As a security measure , text inputted to a password textbox is cleared on post backs. If any of you come across a situation where it needs to be keep password visible on post backs, it would be not as straightforward as you might have think.

Achieving this objective involves following steps.

1. Textbox definition (in the .aspx page)


2. PageLoad code behind
 txtAdminPWD.Attributes("type") = "password"

 If ViewState("Password") IsNot Nothing Then
            txtAdminPWD.Attributes.Add("value", ViewState("Password").ToString())
 End If

3.  Password stored to the textbox in the value and in view state (can be inside a method to populate the password )
ViewState("Password") = Decrypt(cUser.AdminPWD).ToString()
                txtAdminPWD.Attributes.Add("value", Decrypt(cUser.AdminPWD).ToString())

4.Use the javascript PageLoad to restore password textbox value
function pageLoad() {
                setTimeout(function () {
                   $("input#ctl00_cphMainContent_txtAdminPWD").val($("input#ctl00_cphMainContent_txtAdminPWD").val());
                }, 10);
{

5. Clearing the password
txtAdminPWD.Text = ""
txtAdminPWD.Attributes.Add("value", txtAdminPWD.Text)


Cheers
Samitha