tell me why this password feild getting blank.when i select the region,state and city the password feild getting blank.
I don't know when this happens……because when you click a button,you should get the values from them;However when the page renders,password textbox are of very secrect so they become blank according to the ASP.NET's technology
i have name,username,ph.no,email,region,state,city,password,confirm pwd feilds now i fill all the details name,ph.no,email,username when i fill the password,confirm password now the problem is when i select region then immeidiate the inserted password in
text box getting blank.
but when i set the autopostback=false then unable to display the sate and city.bcoz wehn i select region dropdown list then state and then city displayed.
but when i set the autopostback=false then unable to display the sate and city.bcoz wehn i select region dropdown list then state and then city displayed.
Error 4 The best overloaded method match for 'System.Collections.Specialized.NameValueCollection.this[string]' has some invalid arguments C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 33 31 C:\...\Liveproj\
2)
Error 5 Argument '1': cannot convert from 'System.Web.UI.WebControls.TextBox' to 'string' C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 33 44 C:\...\Liveproj\
3)
Error 6 'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\apu\My Documents\Visual
Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 36 26 C:\...\Liveproj\
and i have foll.code on pageload:-
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection con = new SqlConnection(strConnection);
SqlCommand Cmd = new SqlCommand("Select * From Region", con);
SqlDataAdapter DA = new SqlDataAdapter(Cmd);
DA.Fill(DS, "Region");
DdlRegion.DataSource = DS.Tables["Region"];
DdlRegion.DataTextField = "RegionName";
DdlRegion.DataValueField = "RegionID";
DdlRegion.DataBind();
DdlRegion.Items.Insert(0, "---Select---");
string password = Request.Form[txtPassword];
if (password != null)
{
password.Text = password;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection con = new SqlConnection(strConnection);
SqlCommand Cmd = new SqlCommand("Select * From Region", con);
SqlDataAdapter DA = new SqlDataAdapter(Cmd);
DA.Fill(DS, "Region");
DdlRegion.DataSource = DS.Tables["Region"];
DdlRegion.DataTextField = "RegionName";
DdlRegion.DataValueField = "RegionID";
DdlRegion.DataBind();
DdlRegion.Items.Insert(0, "---Select---");
}
if (IsPostBack)
{
string password = Request.Form["txtPassword"];
if (password != null && password != "")
{
password.Attributes["value"] = password;
}
}
}
Error 4 Cannot apply indexing with [] to an expression of type 'method group' C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 41 17 C:\...\Liveproj\
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Data type for email and phone no.
Apr 05, 2012 08:30 AM|LINK
I don't know when this happens……because when you click a button,you should get the values from them;However when the page renders,password textbox are of very secrect so they become blank according to the ASP.NET's technology
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 05, 2012 08:34 AM|LINK
hi,
i have name,username,ph.no,email,region,state,city,password,confirm pwd feilds now i fill all the details name,ph.no,email,username when i fill the password,confirm password now the problem is when i select region then immeidiate the inserted password in text box getting blank.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Data type for email and phone no.
Apr 05, 2012 08:40 AM|LINK
Please cancel AutoPostBack=True for the Dropdownlist。
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 05, 2012 08:51 AM|LINK
but when i set the autopostback=false then unable to display the sate and city.bcoz wehn i select region dropdown list then state and then city displayed.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Data type for email and phone no.
Apr 05, 2012 09:01 AM|LINK
So you should do this in the Page_Load:
if(IsPostBack) { string password = Request.Form["YourPasswordTextBoxId"];{apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 05, 2012 09:11 AM|LINK
getting 3 errors
1)
Error 4 The best overloaded method match for 'System.Collections.Specialized.NameValueCollection.this[string]' has some invalid arguments C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 33 31 C:\...\Liveproj\
2)
Error 5 Argument '1': cannot convert from 'System.Web.UI.WebControls.TextBox' to 'string' C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 33 44 C:\...\Liveproj\
3)
Error 6 'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 36 26 C:\...\Liveproj\
and i have foll.code on pageload:-
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection con = new SqlConnection(strConnection); SqlCommand Cmd = new SqlCommand("Select * From Region", con); SqlDataAdapter DA = new SqlDataAdapter(Cmd); DA.Fill(DS, "Region"); DdlRegion.DataSource = DS.Tables["Region"]; DdlRegion.DataTextField = "RegionName"; DdlRegion.DataValueField = "RegionID"; DdlRegion.DataBind(); DdlRegion.Items.Insert(0, "---Select---"); string password = Request.Form[txtPassword]; if (password != null) { password.Text = password; } }Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Data type for email and phone no.
Apr 05, 2012 09:16 AM|LINK
Oh man!You didn't see what I said above clearly……………………
You should do this——
if (IsPostBack) { ………………………… string password = Request.Form["Your PassWord's TextBox's ID here!!!!!!"]; if (password != null && password!="") { password.Attributes["value"]=password; } }apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 05, 2012 09:29 AM|LINK
now i made code like you said getting one error.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection con = new SqlConnection(strConnection); SqlCommand Cmd = new SqlCommand("Select * From Region", con); SqlDataAdapter DA = new SqlDataAdapter(Cmd); DA.Fill(DS, "Region"); DdlRegion.DataSource = DS.Tables["Region"]; DdlRegion.DataTextField = "RegionName"; DdlRegion.DataValueField = "RegionID"; DdlRegion.DataBind(); DdlRegion.Items.Insert(0, "---Select---"); } if (IsPostBack) { string password = Request.Form["txtPassword"]; if (password != null && password != "") { password.Attributes["value"] = password; } } }Error 4 Cannot apply indexing with [] to an expression of type 'method group' C:\Documents and Settings\apu\My Documents\Visual Studio 2008\WebSites\Liveproj\Usercreation.aspx.cs 41 17 C:\...\Liveproj\
apurva16
Member
21 Points
87 Posts
Re: Data type for email and phone no.
Apr 05, 2012 11:03 AM|LINK
hi,
got the solution its simple just inserted a password after the state and region.this is happen bcoz of updatepanel.
thnx for helping.