|
Hi all
I want to add dropdownlist listitem collection from the database. How can I do this databinding with the database. I am using following code, but it binds the default data to the dropdown list and listitems are static.
<asp:DropDownList ID="dropdownAuflage" runat="server" DataSourceID="DropDownDataSource" DataTextField="field_defaultvalue" >
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:DropDownList>
This code displays the list items, but I want to bind this listitem data with the database.
At present I have four list items and I want to give advantage to user to add more in future if he wishes to do so. So I do not want to hard code the list items in the code.
Can anyone please tell me how can I do it.
Thanks.
|
|
|
|
|
Bind the dropdownlist with the dataset(or datatable) what you are having.
Like this:
Dropdownlist1.datasourse = dataset.tables[0];<br />
dropdownlist.DataTextField = "YourcolumnName";<br />
dropdownlist.DataValueField= "YourothercolumnName";<br />
dropdownlist.databind();
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks, but This is not helping me. I will explain my scenario more:
I have a table having columns "ID" and "DefaultValue". This table will consist of information about no of controls through column ID. And against each ID their default value will be stored.
For DropdownList, suppose ID is ddList1 and values may be "Red|Yellow|Green|Blue",
here Red is selectedText for ddlist1 and other three values will be in dropdown listitem collection.
Can anyone pls let me know how can I do it?
|
|
|
|
|
Here what you need to do is(if i understood the problem correctly) first you have to get the table from the database store it in the dataset and then assign it to the dropdownlist control.
like this:
ddList1.datasource = ds.tables[0];<br />
ddList1.DataTextField = "ID";<br />
ddList1.DataValueField = "DefaultValue";<br />
ddList1.DataBind();
Hope this will help you.
Best Regards,
Apurva Kaushal
|
|
|
|
|
hi apurva..hav u got me..
this is Aavesh..
i want to put RSS feed for my Asp.Net1.1 Application..hav u work on RSS plz if u hav code forit then send me.....i need it despritly..
thanx
Aavesh
|
|
|
|
|
Hello
I'm making a project in ASP.Net 1.1.
Basically its Site Creator Project on which i' working.
My CLient hav uploaded the 20 subdoamin for me.
but i don't how to use these subdoamin either i have to upload my whole project on these 20 subdoamins. or is there any way which i can set the path to my mail domain directly.
i hope i'm able to let u understand my problem.if any thing unclear plz let me know.
thanx
|
|
|
|
|
Yes, there are some things that are unclear.
When you say that your client have uploaded subdomains, what do you mean? Has he created subdomain names or subdomain sites, or is it something Site Creator specific?
How does your mail domain come into the picture? Is your application sending mail?
---
b { font-weight: normal; }
|
|
|
|
|
hi..
actaully he created some subdomains Folder just like a main one in which we upload our project..so,
when i try to run my project from these subdomains URL it does not work so i wanted to ask that whether i have to put my whole project in all the subdomain folders individually or is there any way by which these subdomain can directly be link with the main domain folder.so these links will work automatically
i think now it is something clear..
or yet u didn't got my problem plz tell me the basic concept of subdomain and how can we use these subdomains.
thanx
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
A subdomain is a name that is completely independent from the domain name. The two names doesn't even have to point to the same server.
The most common subdomain is www. Usually the www subdomain is handled by the same web application as the domain, e.g. www.guffa.com and guffa.com point to the same site.
If the subdomains are set up to point to separate folders on the server, the folders are separate applications, and you need to upload everything to each folder.
If all the subdomains should use identical code, they could instead have been set up to be handled by the same application. Then you would only have one folder to upload to.
---
b { font-weight: normal; }
|
|
|
|
|
hello sir,
"If all the subdomains should use identical code, they could instead have been set up to be handled by the same application. Then you would only have one folder to upload to. "
this is exactly what i want to do...but how to do it.
if i will upload myproject into only single folder then how these subdomain will link to the uploaded project.
thanx
|
|
|
|
|
hi try to keep all the new file with existing folder.and refresh ur site folder IIS virtual direcory.and give the directory name like folder\sub folder like that.
with regards,
susa
|
|
|
|
|
sorry i didn't get ur point..
these subdomains are individual folder on server..my site folder is seperate domain and all my project is reside on this folder now how my subdoamin folder will be link to main domain folder with out copying all the project on subdomain folder.
thanx
|
|
|
|
|
In IIS console, open the properties for the web site that you want to handle the names. In the "Web Site Identification" section there is an "Advanced" button, that will open a window where you can add identities for the site. The "Host Header Name" is where you put the subdomain names.
---
b { font-weight: normal; }
|
|
|
|
|
hello
i follow ur steps..
but i didn't get the "Web Site Identification" tab in my Application Properties Window There are only following tab
1.Directory
2.Document
3.Directory Security
4.HTTP Headers
5.Custom Errors
there is no "Web Site Identification Tab" or Option in Project Properties.
Plz tell me exactly from where i can get this Option.
I also ref. this site too.
http://support.microsoft.com/default.aspx?scid=kb;en-us;308163[^]
thanx
|
|
|
|
|
The "Web Site Identification" is not a separate tab, it's on the "Web Site" tab. The first tab when you open the properties of a web site.
The tabs that you listed is not from the properties of a web site, it's from the properties of a folder.
Are you really sure that you have subdomains? There is no subdomain pointing to that folder, as you can't point a subdomain to a regular folder.
---
b { font-weight: normal; }
|
|
|
|
|
hello sir,
i have only the Application Folder in my IIS maanger i hav checked twice & thrice my IIS Manager but i didn't find any Web Site Tab.
even though i'm not getting for which "WEB SITE" u r talking abt becoz i hav only my application in Default Web Site tab.
here i'm just checking the My Application Properties.
plz clear my doubts.
thanx
|
|
|
|
|
Hi all,
Can any body send me the code for doing the Edit item in Data Grid (Asp.Net). actually i done it is not working. can any body send it for me
Thanks in advance
Thanks and Regards
Venkat
|
|
|
|
|
Go through the articles in this link. You will get lot of samples on datagrid.
http://www.datagridgirl.com/articles.aspx
Best Regards,
Apurva Kaushal
|
|
|
|
|
//edit template
<EditItemTemplate> <asp:TextBox runat="server" id="txtbox1" Text='<%# DataBinder.Eval(Container.DataItem, "FieldName1") %>'/>
</EditItemTemplate>
//and event
Sub MyDataGrid_Edit(Sender As Object, E As DataGridCommandEventArgs)
MyDataGrid.EditItemIndex = CInt(E.Item.ItemIndex)
End Sub
Nav.
|
|
|
|
|
Hi All,
My stuff is like this :
By clicking on a button, you open a window to handle parameters. When the child window is open, you fill the form and you can create a new parameter by clicking on a LinkButton. The LinkButton calls an handler to create parameters. How to call a client javascript function to close the child Window and recover the ID parameter in the parent window.
----------------------
Parent Window
<asp:button id="ButtonOpen" runat="server" text="..." causesvalidation="False" onclientclick="UserControlRel_CityDisplay();">
ButtonOpen call a ShowModalDialog to handle parameters.
-----------------------
-----------------------
Child Window
<asp:linkbutton id="ButtonOK" runat="server" text="<%$Resources:GlobalResources,ButtonOK %>" tooltip="<%$Resources:GlobalResources,ButtonOKTooltip %>" cssclass="cssLinkButtonOut" onmouseover="this.className='cssLinkButtonOver'" onmouseout="this.className='cssLinkButtonOut'" causesvalidation="True" onclick="ButtonOK_Click">
ButtonOK_Click call the handler to create a new parameter. In this function, I recover the ID of the new parameter and I want to send.
Thx for your help.
|
|
|
|
|
|
use session variable for it.put ur value in session variable like
Session("Var_Name")= Value
|
|
|
|
|
i can't use session varaible in this application
|
|
|
|
|
If the data is not very important then you can maintain it in querystring also.
Best Regards,
Apurva Kaushal
|
|
|
|
|