VS 2012 - Repopulating Cbo2 Based On Selection Of Cbo1 In GridView

Jul 9, 2013

I have an web app I'm developing and it contains a form with a gridview. The grid view has 2 dropdowns...cbo1, and cbo2

The gridview is in Edit mode and when I select something from cbo1, i need to re-populate cbo2.

Here's the source code that shows my grid and dropdowns:

Code:
<asp:GridView id="gridOutdoor" EnableViewState="false" onrowdatabound="gridOutdoor_RowDataBound" onrowediting="gridOutdoor_RowEditing" AutoGenerateColumns="False" runat="server" PageSize="5" CssClass="GridView" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" >
<Columns>
<asp:CommandField ShowEditButton="True" />

[Code] ...

Here's the sqlDataSource that's also in the source page:

Code:
<%-- cbo1--%>
<asp:SqlDataSource ID="SqlDataSourceProduct" runat="server" CancelSelectOnNullParameter="false" ConnectionString="<%$ ConnectionStrings:QuoteToolConnectionString %>"
SelectCommand="select distinct cat1 as Product from QuoteItems where accessory=0">
</asp:SqlDataSource>
<%-- cbo2--%>

[Code] ...

As you can see, for sqlDataSourceBodyColor, I have a param and it needs to get the value from the user's selection of cbo1.

In the RowDataBound event, I had set it up to get this value. It works great for the initial load of the page; but when I make a selection from cbo1, the value of cbo1 when debugging, is always what ever was first set when going into edit mode - the bound items.

here's the code for that:

Code:
Protected Sub gridOutdoor_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim cbo1 As DropDownList = CType(e.Row.FindControl("ddProduct"), DropDownList)
Dim cbo2 As DropDownList = CType(e.Row.FindControl("ddBodyColor"), DropDownList)

[Code] .....

View 1 Replies


Similar Messages:

How To Fill An Inner Gridview Based On Outer Gridview Selection

Apr 5, 2010

I have 2 GridViews, the InnerGridView is nested inside a TemplateField of my OuterGridView.

Each GridView has an ObjectDataSource (ODS). I want the InnerGridView to display data that is unique
to the GroupName that is listed in the OuterGridView. I have been Googling this for weeks, seeing various based around RowDataBound and the ODS Selecting event.

I don't think RowDataBound is the answer, because the Selecting event for the InnerGridView ODS
has already been called when RowDataBound is called for the OuterGridView.

So, I need to send a parameter to the ODS for the InnerGridView:

[code]...

Note: This method is assigned to the Selecting event of the InnerGridView ODS.

How do I access the GroupName from the OuterGridView... while I am processing the InnerGridView.

Here is an example of something that does not work:

OuterGridView.SelectedRow.FindControl( "GroupName" ).ToString();

I have heard that one can find any control from inside the Selecting event by searching a certain hierarchy.
But I don't know how to access that hierarchy using the "e" or "sender" parms.

View 1 Replies

Data Controls :: Delete Row In GridView Based On DropDownList Selection

Nov 18, 2013

To what extent our institution is useful for you  Dropdownlist1(Good/Poor).When user select the Poor form the Dropdownlist1 in that case  ONLY POPUP screen will be displayed.The POPUP Screen as follows

            Textbox (In that textbox user type the reason for Poor)
             Submit(Button)

When user Click the Submit (Button) the selected dropdownlist and Remarks will be displayed in the Gridview. The Gridview as follows

              Dropdown           Reason
                 0                       The institution has to be improved for lot

instead of Select the Good from dropdownlist1, user wrongly select the Poor from the dropdownlist. that time POPUP screen is to displayed.(Only when user select the Poor from the Dropdownlist POUP Screen is to be displayed in that textbox type the reason and click the Submit Button).  Then Gridview as follows

              Dropdown           Reason
                 0                       The institution has to be improved for lot

Then user again select the Good from the Dopdownlist1 means Previously value in the Gridview.Dropdown and reason has to be deleted in the Gridview.for that how can i do using csharp.

View 1 Replies

Data Controls :: Populate GridView Based On DropDownList Selection

May 7, 2015

If the drop down list event change gridview column values to be changed.

View 1 Replies

Data Controls :: Conditionally Update Value Of GridView Row Based On DropDownList Selection

Mar 11, 2014

How to update each data in gridview from template field textbox?

if select reason is adjust-In then update plus the qty else adjust -Out minus the qty. 

<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3A64F2" HeaderStyle-ForeColor="White" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField= "RowNumber" HeaderText="RowNumber" />
<asp:BoundField DataField= "INV_ID" HeaderText="INV_ID" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_TYPE" HeaderText="INV_TYPE" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_SHORTDESC" HeaderText="INV_SHORTDESC" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_LOCATION" HeaderText="INV_LOCATION" ItemStyle-Width="150" />
<asp:BoundField DataField= "INV_QTY" HeaderText="INV_QTY" ItemStyle-Width="100" />

[CODE]....

View 1 Replies

Data Controls :: Filter And Populate GridView Based On List Box Selection

May 7, 2015

As per ListBox Items a data should show in GridView by using UP and Down arrow keys. I tried by using Oonselectedindexchanged but when a page loads from listbox the cursor become active to inactive.

View 1 Replies

Web Forms :: Enable Disable Validators In GridView Row Based On CheckBox Selection?

Nov 28, 2012

I have one gridview with two template fields check box and dropdown and my doubt is dropdown validation should occur only for check box selected items..

 In my form all the dropdown shows validation even though if check box is not selected

<Columns>
<asp:TemplateField>
<ItemTemplate>

[Code]....

View 1 Replies

Forms Data Controls :: Display Gridview Based On Dropdown List Selection?

Feb 21, 2010

I'm having trouble figuring out how to display a gridview based on the selection of a drop down list. I manually entered the drop down list items, but in the configure/choose data source I don't understand how you make a relationship between each list item and the corresponding database table you want to show.

View 7 Replies

Forms Data Controls :: Inserting Records Based On Checkbox Selection In Gridview

Sep 10, 2010

Using checkboxes, can the row of record(s) be inserted into a database? I am populating a Gridview. Done. A checkbox field has been added, when the user selects one or more rows, a submit button (which is not working) needs to inserting those records into a table. The insert statment will work outside of the page but is not working using the scenario I jut described. Is this task as I have outlined doable?

View 13 Replies

Data Controls :: Enable Disable TextBox In GridView Based On RadioButton Selection

Apr 26, 2014

i have radio button list and one textbox in gridview if the value is yes text has to enable otherwise i need disable the text box in grid view how do this?

View 1 Replies

VS 2012 - Set BGColor Based On SQLDatasources

May 7, 2013

How to set the bgcolor of an asp.net cell from code behind using a value from a sqldatasource?

I have a working sql data source that is used to populate labels in my html form using asp.net.

The background color of the cell depends on a comparison of the actual value versus the target value. If the actual daily value exceeds the limit I would like to change the bgcolor of a cell in the web page. The actual value comes from one datasource and the limit comes from a 2nd data source.

In vb code behind I would like to accomplish the following pseudo code:

If (sqlsource1Total > sqlsource2Limit) Then
bgXCell.BgColor = "#ccff99"
Else
bgXCell.BgColor = "#ff9999"
End If

View 3 Replies

Forms Data Controls :: Display Some Xml Tags In Gridview Dynamically Based On User Selection?

Jul 17, 2010

i have displayed a xml file in the tree view form by binding them....now i want a sample code to access the nodes which are being selected and to display dynamically in a grid view ..in asp.net/c#

View 4 Replies

Forms Data Controls :: GridView Page Reset Based On DropDown List Selection?

Jan 3, 2011

i want to see the sales in the grid view based on the month selected from drop down list. Ex: when I select June 2010 from the ddl box, the sales for that month are correctly displayed in the grid view. I go to page 4 to look at some sales there and then switch the month to August 2010 to see sales for that month instead. Here is the problem. When I switch the month, it show August 2010 sales, but stays in page 4 instead of going back/resetting back to page 1 of August 2010 sales.

How do I reset the grid view page back to the first page of August 2010 sales?

I am fairly new to ASP. If I have missed an imp. detail in this post, let me know and I will get that info. out there.

View 4 Replies

Forms Data Controls :: Checkbox Selection Based On Group Column Values In Gridview?

Jul 28, 2010

I have to select checkboxes besed on group column values. If you see below gridview, column 3 (GroupN) has 1,1,1,1,2,2,2,2....etc (this column data is not static, will change based on page index. i.e PageIndex =2 may starts with 7,7,7,8,8,8,8,8,9,9,9 etc).

Now My question is.

1). If user selected '1', we have to store value and user must and should select another '1' (atleast two times).

2) If user selected '1', and user trying select '2'. Giving error says "Must have select one then one record in group to combine' (will not allow) and unselect '2'.

3) If user selected '1' atleast two times, and user trying select '2'. Will allow.

4) If user selected '1' atleast two times and selected '2' one time, trying to select '3'. will not allow user to select '3'.

View 3 Replies

Data Controls :: Enable Disable TextBox Inside GridView Based On DropDownList Selection

Apr 27, 2014

i have one dropdown list and one gridview in my page by default all the textboxes in gridview enabled if i change the dropdown value textboxes in the gridview has to disable how to implement this?

View 1 Replies

VS 2012 - Dynamic Text Boxes Based On Textbox Number Entry

May 18, 2015

I'm going to have a textbox on my ASPX page - where users can enter a number between 1-50.

Based on their selection, I'd like to add three textboxes for each number and number them appropriately.

I'd like three textboxes for each "number", so for example, the fields would be:

Name1, PIN1, Desc1
Name2, Pin2, Desc2
Name3, Pin3, Desc3
...

So, how do I, at runtime, add these fields to my page?

Secondly, This form, upon submittal, creates a configuration file on my server currently in the format of

[FIELD1]
FieldOne.Value
[/FIELD1]

[FIELD2]
FieldTwo.Value
[/FIELD2]

[FIELD3]
FieldThree.Value
[/FIELD3]

With those fields, it's rather easy, as the form has static controls that I'm looking up and sending to my file.

How would I add the dynamic controls to the file as well? Obviously, if they've selected to add 10 fields, I don't want 40 other fields of blank/nothing (since they can choose to add up to fifty). How would I iterate only adding the fields that they've chosen?

I'm writing in VB.NET not C

View 3 Replies

How To Hide The Panel Based On The Selection

Feb 25, 2010

I am not sure how to fine tune this, but it seems to me like it should be rather simple. I have a RadComboBox on my page that only has two possible values:

[Code]....

When the user changes it to "Joint" I want the asp panel named 'CoApplicant' to become visible. If changed back, then hide again. Here is my javascript code which is not working:How do I hide that panel based on the selection?

View 3 Replies

How To Redirect Based On Selection Of DropDownList

Jul 26, 2010

I have a TextBox1 and a Search button in my application with this following code:
protected void Button1_Click(object sender, EventArgs e) {
Response.Redirect("~\searchpage.aspx?PatientNRIC=" + TextBox1.Text); }

Which means, if the user type ONLY IC NO:S1234567D, then when click it will show the patient detailview. So I now I'm doing almost the same thing but now I have a TextBox2 and a DropDownList1. Inside DropDownList1, I have "Name", "IC No", "Test_Date". So for an example, I type "S1234567D" in the textbox1, and I choose "IC No" in DropDownList1 it should redirect me to a page of the S1234567D's patient detailview. How could I do my code?

View 2 Replies

Using Concat Querystrings Based On Checkbox Selection?

May 5, 2010

i have a querystring like this : Comparison.aspx?id=4545&Product=foo&displaylevelname=128

it's being build by 3 hidden fields in a html tablerow based on checkbox selection.

but user can select multiple checkboxes (20) and afterwards

i need a querystring like this : Comparison.aspx?id=4545&Product=foo&displaylevelname=128;145;455;

So how do i go from :

Comparison.aspx?id=4545&Product=foo&displaylevelname=128

Comparison.aspx?id=4545&Product=foo&displaylevelname=145

Comparison.aspx?id=4545&Product=foo&displaylevelname=455

To Comparison.aspx?id=4545&Product=foo&displaylevelname=128;145;455;

View 4 Replies

Web Forms :: Stuck In Condition Based Selection

Jul 30, 2010

I have CheckedListbox and grid. Based on what are the items checked in listbox that much of items need to be shown in grid. My SQL procedure like ;
select * from Emp
where city in (@Names)

Everything is ok if I am checked any of the item and click OK. If I am nothing checked from the listbox I need to display all of the cities from DB. I need to do this work without modifying my procedure. So need to work out in front/end. If I pass nothing from the code the query seemed as select
* from Emp
where city in ('')
So no records getting...

View 7 Replies

Web Forms :: Showing Controls Based On Selection?

Sep 29, 2010

I am building a application with some forms. The layout was delivered to me in HTML page and I am rebuilding it now to ASPX pages. One page has two radiobutton boxes from which a user can choose one option (of one of the radiobuttonlists). Based on that selection a third redaiobuttonbox shows up at the right of the page with another selection choice. When the third radiobutton is selected a new page is loaded in a iframe (in the original page) with a control (textbox, button or some textfields). What exactly should be loaded is based on the selection of the third radiobutton. Now I wanted to know if it would be possible to do this all in one page, for example can i make a panel that could be dynamically filled with the right controls?

View 2 Replies

C# - Saving ID To Database Based On Dropdown Selection?

Feb 20, 2011

I am using the following code to bind BusinessID as the DataValueField of the ddlIndustry dropdown. What I want to do is save the selected ID to a different table (Company). I am doing this with ddlIndustry.SelectedValue. For some reason, the first value is always saved (1), and not the selected value.

[code]....

View 1 Replies

VS 2012 - Can Do A Post From GridView?

Jun 4, 2013

I have a gridview on a page where I display a list of items. One of the columns on the gridview is a hyperlink that sends a querystring to another page, which then displays the details of the selected item. It's your basic CRUD operation and it works great except for one thing: The query string has some information in it that I'd rather not be public. Is it possible to have a link or a button or some other sort of column that does a post to the new page instead of a querystring?

View 29 Replies

Populating A Website With Data Based On A User Selection?

Jun 29, 2010

Just wondering the best way to do something. I want to fill up fields on a website based on a selection from a list. For example, the user selects "Melbourne" from a list of Australian capital cities and the page will fill up with information from the database relating to Melbourne.

View 1 Replies

Web Forms :: How To Show Result Set Based On Dropdownlist Selection

Aug 3, 2010

I have one asp.net dropdownlist which consist A,B values. If user Select A in dropdownlist i need to bind this query to Gridview. Select FirstSelection from Tablname else Select SecondSelection from Tablename. How to do so..?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved