|
hi!!!!
i need to know ..
i have one dropdownlist called as ddlcountry. in this ddlcountry i m binding with table name called countries . i have one more table called userdetails .. already one user registered and selected his country frm ddl called USA .
so my doubt is i want to update his profile . when even user click his update page so i ll all from of him form db , here in ddlcountry .automatically show USA in ddlcoutry, do u know how to do it.
try and try untill reach success..
|
|
|
|
|
Rajeshwar Code- Developer wrote: so my doubt is i want to update his profile . when even user click his update page so i ll all from of him form db , here in ddlcountry .automatically show USA in ddlcoutry, do u know how to do it.
If you have the user information, its means you know the User Country. So set the Same to ddlCountry.
DropDownList1.SelectedValue = UserCountry;
Hope this will help
|
|
|
|
|
thanks for reply
i tried that .. seletedvalue showing null value..
try and try untill reach success..
|
|
|
|
|
Rajeshwar Code- Developer wrote: i tried that .. seletedvalue showing null value..
Why does you DropDown list does not have any data ? What are the value of those ?
|
|
|
|
|
here the thing is i was many countries binding to ddl frm countries table ..
so there is one more table called userdetails. for one user having one country right .. i want show automatically his country inj ddl.
try and try untill reach success..
|
|
|
|
|
This is my Dropdownlist. [ I assume you are binding it from Database.
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>us<asp:ListItem>
<asp:ListItem>india<asp:ListItem>
<asp:ListItem>koria<asp:ListItem>
<asp:ListItem>canada<asp:ListItem>
<asp:DropDownList>
[ I have removed / for formatting. ]
In page load I am using this,
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.SelectedValue = "india";
}
Here rather than india, you should use the value of user country.
|
|
|
|
|
thanks abhijith !!!
See my code one..
ddlCountry.SelectedValue = ds.Tables[0].Rows[0]["sCountry"].ToString();
am doing like this ?
in Selectedvalue showing null value.
try and try untill reach success..
|
|
|
|
|
Rajeshwar
First bind the ddlCountry with your country table data and
than use below mentioned code to select user's country.
ddlCountry.ClearSelection()
ddlCountry.Items.FindByText("user's country").Selected = True
Be an Eagle, Sky is Yours.
|
|
|
|
|
still there is no result..
try and try untill reach success..
|
|
|
|
|
When page loads, first Bind the Data with the dllCountry . Choose appropriate DataTextField and DataValueField .
Now after you finish your load using DataBind , use this.dllCountry.SelectedValue with the DataValueField you want.
Also please check if you have wrote
If(IsPostBack)return; in the Form_Load, so that when the page is posted back the selection remains.
|
|
|
|
|
Abhishek Sur wrote: Choose appropriate DataTextField and DataValueField.
I guess he is missing bind with DataValueField
|
|
|
|
|
yes... right.
If DataValueField is not specified, the value will be same as DataTextField . I personally always set ID as value so that I could set SelectedValue with some numeric field or GUID , as TextField may repeat.
|
|
|
|
|
thnks for all who reply me .. i tried like this also bu there is no output..
and this is my code
if (!IsPostBack)
{
DataSet ds1 = new DataSet();
ds1 = ad.dsGetvalues("Select * from Countries", true);
ddlCountry.DataSource = ds1;
ddlCountry.DataTextField = "sCountryName";
ddlCountry.DataValueField = "sno";
ddlCountry.Items.Insert(0, "--Select--");
ddlCountry.DataBind();
DataSet dss = new DataSet();
dss = ad.dsGetvalues("select * from UserDetails where PkiUsername ='"+Session["Username"].ToString()+"' ", true);
ddlCountry.SelectedValue = dss.Tables[0].Rows[0]["sCountry"].ToString();
}
try and try untill reach success..
|
|
|
|
|
Rajeshwar Code- Developer wrote: ddlCountry.DataValueField = "sno";
Try this
ddlCountry.DataTextField = "sCountryName";
ddlCountry.DataValueField = "sCountryName";
|
|
|
|
|
I'm using data access class that handles SQL requests and updates to db.
After I added delete, edit buttons in GridView, any clicks returns in error that the RowEditing, Deleting was not handled.
Also how can I update the GridView after I modified the selected row in DB? I use selection to edit that record in another page, and then update DB with custom DB class. How to alert GridView and its DataSet that the record now has different contents?
I tried to use ObjectDataSource for that purpose but it failed to launch reporting ambiguity between ~\bin web project module and the ASP.NET temporary one under windows folder
Чесноков
|
|
|
|
|
|
After the ASP.NET project is put to external server with db in ~\App_Data folder (using SQL 2005 express edition), any updates or insertions of records into db fail with error that DB is read-only.
How to set up it with RW access rights. Or it is due to App_Folder location glitch?
Entire web project folder has RW access setup in IIS
Чесноков
|
|
|
|
|
|
But I never attached the DB in SQLEXPRESS. The App_Data is RW by all means, I'm writing logs into it.
Чесноков
|
|
|
|
|
there is no sseutil.exe either
Чесноков
|
|
|
|
|
How to create name of the website in IIS?
I tried but i can't.
I opened IIS, in DefaultWebSite i right clicked but no option is there for creating new website.
I can see only New,All Task and View in Default website when i right clicked.
I New option i can find New->virtual Directory. Not New->WebSite.
Is there any solution for creating website name?
I am using IIS6.
I tried from http://www.startvbdotnet.com/aspsite/extras/deploy2.aspx[^]
|
|
|
|
|
kavinnagarajan wrote: I New option i can find New->virtual Directory. Not New->WebSite.
Expand Web site Folder, ther yo will find Default Web Site . Right Click on that, you will get, New > Virtual Directory.
let me know if you have any issue
|
|
|
|
|
|
Suresh, I am just few sec late
|
|
|
|
|