Web Forms :: Select Theme From DropDownList?
Oct 11, 2010Im pretty new and Im not sure what Im doing wrong here. Could anyone please take a look at my code an let me know what my problem is.
[Code]....
Im pretty new and Im not sure what Im doing wrong here. Could anyone please take a look at my code an let me know what my problem is.
[Code]....
I had use a combox to let user select staff name and then it will automatically retrive the responsible recommending officer and approving officer to display in other 2 dropdownlist.
my code works fine but when user select staff name each time, the page will reload once to refresh the dropdownlist.
user complaint and don't want the page reload every time, how can i disable the postback? I need to use ajax?
[Code]....
[Code]....
im working on Visual Studio 2010, and im making a .net web page. The final idea is to use filters by using dropdownlist. By now i have 3 dropdownlist in cascade. The first filters the second and so on. Then by a grid view i display the selected items, right now i need to add an item that allows me to select all the items in the dropdownlist so in the next filters i like i have selected all. My code filters everything but i cant add this item. I only work in asp .net, not in the code behind wich i think is #C if im not wrong... i have to add a button in each dropdown.
I have read others post and the say that i have to add this in the dropdown>> "appenddatabounditems="True" and this sql sentence
WHERE ([PROJID] = CASE WHEN @PROJID= -1 THEN [PROJID] ELSE @PROJID END)
but it doesnt work.
heres the code.
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT [PROJID] FROM [sxb_Proyectos] ORDER BY [PROJID]">
</asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" Text="Proyecto"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" AppendDataBoundItems="true"
DataTextField="PROJID" DataValueField="PROJID">
<asp:ListItem Value="0"><Select an option></asp:ListItem>
<asp:ListItem Value="-1"><Select All></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT DISTINCT Ax50_Empleados.emplid, Ax50_HorasRegistradas.EMPLID
FROM Ax50_Empleados
INNER JOIN Ax50_HorasRegistradas
ON Ax50_Empleados.emplid = Ax50_HorasRegistradas.EMPLID
where PROJID = @PROJID
ORDER BY Ax50_Empleados.emplid">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label2" runat="server" Text="Rut"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="emplid" DataValueField="emplid">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT DISTINCT sxb_Producto.Producto, Ax50_HorasRegistradas.LINEPROPERTYID
FROM sxb_Producto
INNER JOIN Ax50_HorasRegistradas
ON sxb_Producto.Producto = Ax50_HorasRegistradas.LINEPROPERTYID
where emplid = @emplid and PROJID = @PROJID
ORDER BY sxb_Producto.Producto">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="emplid" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label3" runat="server" Text="Producto"></asp:Label>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3"
DataTextField="Producto" DataValueField="Producto">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource4"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="PROJID" HeaderText="PROJID"
SortExpression="PROJID" />
<asp:BoundField DataField="EMPLID" HeaderText="EMPLID"
SortExpression="EMPLID" />
<asp:BoundField DataField="LINEPROPERTYID" HeaderText="LINEPROPERTYID"
SortExpression="LINEPROPERTYID" />
<asp:BoundField DataField="QTY" HeaderText="QTY" SortExpression="QTY" />
<asp:BoundField DataField="TXT" HeaderText="TXT" SortExpression="TXT" />
<asp:BoundField DataField="TRANSDATE" HeaderText="TRANSDATE"
SortExpression="TRANSDATE" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
ProviderName="<%$ ConnectionStrings:TestingConnectionString.ProviderName %>"
SelectCommand="SELECT [PROJID], [EMPLID], [LINEPROPERTYID], [QTY], [TXT], [TRANSDATE], [TRANSSTATUS], [DIMENSION], [DIMENSION3_] FROM [Ax50_HorasRegistradas] where PROJID = @PROJID and emplid = @emplid">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList3" Name="Producto" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList2" Name="emplid" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
</form>
i have DropDownList with sql select commend
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource_department" DataTextField="Department"
DataValueField="Department_No" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource_department" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Department_No], [Department], [Code] FROM [Departments]">
</asp:SqlDataSource>
in the behind code, i can get the value using "DropDownList1.SelectedItem.Value" for Department_No and "DropDownList1.SelectedItem.Text" for Department
but i want also get the selected value "Code"
I want to use a dropdownlist control so that a user can select a value. My problem is, the text value can be very large. Is there any way to make the text to appear on more than one line? Or is there any AJAX or jquery solutions? I can use a gridview with a checkbox but my client really wants a dropdownlist.
View 3 RepliesHow to select multiple fields from a dropdownlist..
View 6 RepliesI am binding a dropdownlist through stored procedure on page load.
There are tho fields in my databse table City and Class.
in dropdown property i put DataTextField="City" DataValueField="Class"
suppose there are 6 cities in dropdown 3 cities for class A and 3 for class B, see if i select any one city of class A, after select droodown automatically select the first city of class A, and same if i select a city of class B, it auto selects first city of
class B.
and here i am binding my code..
[Code]....
Iam using dropdownlist with required filed validator and Iam getting the text from db and binding to dropdownlist so its comng well but it is showning two times in dropdown I mean in actal place and the select place so whenever I click on button it firing...
Code:
<asp:DropDownList ID="ddlMemberType" runat="server" CssClass="product-textbox" Width="420" onchange="changeMember();">
<asp:ListItem Value="Select" Text="Select MemberType" />
<asp:ListItem Value="Family" Text="Family Man" />
<asp:ListItem Value="Employee" Text="Employee" />
[Code] ....
I have a GridView with a templatefield that contains a dropdownlist. I want to insert the selectedvalue as a datetime field into a table.
This is my code:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim shippingdate As DateTime
[Code]...
Multiple Select (MultiSelect) DropDownList with CheckBoxes in ASP.Net using jQuery. But i want save to database several selected value dropdownlist.
View 1 RepliesI have 2 Dropdown(say "DD1", "DD2") and 1 Listbox(say "LB") in my web form,value of the 3 controls depend on each other.
"LB1" is dependent on "DD2" value, "DD2" is dependent on "DD1" value.
I want that if user selects "LB1" without selecting "DD2", it should give a message that "please select DD2 first"similarly if user Selects "DD2" without selecting "DD1", it should give a msg that "Please select DD1 first" ,using ASP.NET C.
Here's what I want to accomplish: I have two .aspx pages, the first page with a ddl to select a vendor (SelectVendor.aspx), and one to add a vendor (NewVendor.aspx), if it's not in the first one. If a user adds a new vendor on the NewVendor.aspx page I want the page to automatically redirect back to SelectVendor.aspx and have the ddl automatically select the new vendor that was just added. Here's where I'm at so far: If a vendor is not listed in the ddl on SelectVendor.aspx, a user can click a button to navigate to a page to add a new vendor (NewVendor.aspx). On NewVendor.aspx the user types the name of the new vendor in a textbox and clicks an insert button to add the new vendor, then the page is automatically redirected back to SelectVendor.aspx with the new vendor name added to the QueryString. For example, let's say a user adds a vendor name "Best Vendor": The page is redirected back to SelectVendor.aspx as "SelectVendor.aspx ?vendor=Best Vendor"Now all I need from here is to have the ddl programmatically select the new vendor by the text value in the QueryString.
Here is the code that I'm having trouble with from my Page_Load routine for SelectVendor.aspx:
[Code]....
i need to select multiple items in a dropdownlist. This is my code,
<asp:DropDownList ID="ddllocation" runat="server" Width="80px">
<asp:ListItem>Chennai</asp:ListItem>
<asp:ListItem>Madurai</asp:ListItem>
<asp:ListItem>Coimbatore</asp:ListItem>
<asp:ListItem>Nilgiris</asp:ListItem>
<asp:ListItem>Palaghat</asp:ListItem>
</asp:DropDownList>
How can i add tat option.
I am trying to populate a gridview when you select the dropdownlist.selected value. I don't want to use the sqldatasource or any other datasource. I am trying my best to achieve this, but didn't succeed till now. One of my friend said that i need to get the selected value from dropdownlist and search for the data in the database using the selectedvalue and populate the dataset and bind to the gridview.
View 2 RepliesI have 2 dropdownlist controls (ddl1 and ddl2). When I pick an item from ddl1, it will update ddl2. The problem is when I pick an item in ddl2, it always selects the first item in the list. Is it that the ddl2 autopostback causes the first ddl1 to reload and results the ddl2 to be refreshed also? Or I didn't set something correctly?
[Code]...
When I try to use this code in a Form View, I get an error message:
Compiler Error Message: CS0103: The name avgift_namnTextBox is not in the current context
ROW: 35
Rad 33: if (dropDownlist.SelectedValue == "Other")
Rad 34: {
Rad 35: avgift_namnTextBox.Enabled = true;
Rad 36: avgift_namnTextBox.Text = string.Empty;
Rad 37: avgift_prisTextBox.Enabled = true;
Here is my code:
<%@ Page Title="Lista medlem" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="medlem.aspx.cs" Inherits="medlem" %>
<asp:FormView ID="FormView3" runat="server" DataKeyNames="faktura_id"
DataSourceID="SkapaFaktura" DefaultMode="Insert" Width="687px">
<InsertItemTemplate>
[Code]....
I have drop down list in my page that contain cities name i bind it from city table
city id
Paris 1
Germany 2
Italy 3
USA 4
i have complete date in a textbox i want to make the selected value in drop down list_days equal the day part of textbox,the selected value in drop down list_months equal the month part of textbox & the selected value in drop down list_years equal the year part of textbox to make the user update it if he want i tried to find the answer but i coudn't.
View 1 Repliesthis is my table
dept Table
dept Id (primary key column)
dept Name
101
sales
102
admin
I have been trying for a while to populate a formview when I select an item from the dropdownlist. The dropdownlist is outside of the formview. For some reason, when I select a different item it does not change in the formview. Only the first item of the list shows up. I don't know where I'm doing wrong. I tried many things and suggested informatioin and I still could not get it to work. When I do try to switch I get this error message:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[Code]....
[Code]....
I am binding a control which is inside Gridview, using SqlDataSource control as below.
<asp:ComboBox ID="ddlCompany" runat="server" Height="200" Width="240"
DropDownWidth="310" EmptyMessage="- Select Product -" HighlightTemplatedItems="true" CausesValidation="false"
Filter="Contains" AppendDataBoundItems="true" AllowCustomText="true" AutoPostBack="true"
DataTextField="Title" DataValueField="Code" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged">
</asp:ComboBox>
[code]....
In above SqlDataSource control, I had to pass the SelectParameter (whose value is coming from a ComboBox i.e., whatever comboBox value I selcect from ComboBox, its SelectedValue I had to pass it to the SqlDataSource SelectParameter. I am first time using "SqlDataSource". How to pass the SelectedValue of ComboBox into SlecteParameter of SqlDataSource control ?
I have dropdown list in my page
BindDropDownList(DdlDistrict, "District1", "District", "ID");
DdlDistrict.Items.Insert(0, new ListItem("select district", "0"));
And I use this code for binding from database
DdlDistrict.Items.FindByText(_dr["District"].ToString()).Selected = true;
Here if in database have value it show in ddldistrict
Now I want if there wasn't any thing in database in dropdown list show "select district" that i define here
DdlDistrict.Items.Insert(0, new ListItem("select district", "0"));
I would like to know if I can do the following: when I am in insert mode, can I dynamically change the select command of and then display that result in the second dropdownlist based on what was selected in the first dropdownlist.
I would like to include the minimum code to demonstrate what I am trying to do.
[Code]....
[Code]....
I'm building a pretty simple application where a user can enter/modify/delete data from a table. Right now, the only field is month, which I'm storing as an integer (1-12). The actual table has more fields but I'm simplifying for the purposes of this question.I have the entry part. For modifying, I've set up a gridview with an 'Edit' button:
[Code]....
The code is putting the gridview row into edit mode. Now, I want to show a dropdownlist of months so the user can select the new month. Also, I would like the dropdownlist to default to the value in the database. I can't figure out how to bind months to the dropdown list ddlMonth.
Two ddl inside gridview. on selecting first ddl1 fill next ddl2 by passing selected value as parameter by executing the sqldatasource select command in codebehind.code:
GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent; //find the control in that DropDownList d1 = (DropDownList)gr.FindControl(ddl1); DropDownList d2 = (DropDownList)gr.FindControl(ddl2); SqliaDataSource.SelectParameters.Add("@name", d1.SelectedItem.Text.ToString()); dataView dv=(dataview) SqliaDataSource.select(DataSourceSelectArguments .Empty);
Error: There is no source code available for the current location. and Returns null value