getting selected data in grid view according to the selected value in drop down

hi! how can i change the grid view data according to the selected value in the drop down list?

11/23/2007 7:50:50 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 41
Get it on Google Play
Get it on Apple App Store

Make the DataSource the GridView is bound too have a select statement that uses the value of the dropdownlist as a parameter.



11/23/2007 9:22:16 PM

 Bind your grid in your drop down selectedindexchange and reference the value being selected in your query like

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        string val = DropDownList1.SelectedItem.Text;
        //Code for populating your grid here like
        // Select * from TableName where Category = "' + val + '"

       //Store the result in a DataTable and have it as your DataSource
       //Bind your Grid here


"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
11/23/2007 9:43:19 PM

Similar Artilces:

Hi how to fire a dropdown which is binded inside a gridview control the binding took place in rowdatabound column,now i want that when i select an item from the dropdownlist,few gridcells shd populate with data ...on which event should i write and how... Thanks... You can design a function where u want to do some processing say functionXYZ. Now in PageHTML View where dropdown is declared in GrdiView u can do like that:<asp:DropDownList id='DropDownListID runat=Server autopostback=true enableviewstate=true OnSelectedIndexChanged="functionXYZ"> functionXYZ u ca...

How Do a get a columnID value from Grid View Selected row
Hello All Asp gurus, Am a newbie. How do I get a ColumnID value from a GridView List, I want to get the file ID and call update or delete function using click buttons I have tried this line but is not working on me Dim ColItem As String ColItem= GridView1.DataKeyNames(GridView1.SelectedIndex).Values("ChannelID").ToString Please help   Try this: 1 <asp:GridView ID="GridView1" runat="server" 2 DataKeyNames="ChannelID" />   1 If GridView1.SelectedIndex >= 0 Then 2 Dim id As String = GridView1.Da...

How to get all values from data grid without selecting the row?
  I have a page that contains a datagrid (all input/editable fields), I want to be able to get the value for each row then add it to a dataset to save it into the database. How can I do that? this is how i add the columns dtg = new DataTable(); dc = new DataColumn("Invoice Date", System.Type.GetType("System.String")); dtg.Columns.Add(dc); dc = new DataColumn("Target Billing Amount", System.Type.GetType("System.String")); dtg.Columns.Add(dc); dc = new DataColumn("Amount Co...

How to access the selected value of a drop down list in a grid view.
I can access the text value within a gridview using the following command Dim username As String = GridView1.Rows(index).Cells(6).Text.  However, I need the equivalent code for the selected value of a drop down list.  Thanks ahead for the help. Hi jason,You would have to use:DropDownList myDropDownList = GridView1.Rows[ index ].FindControl( "myDropDownList" );String selected = myDropDownList.SelectedValue;Good Coding!Javier Luna Villa El Salvador for world! Worked perfect.  Thanks alot....

Grid View
Hi, Once Edit has been clicked, i want the drop down list to default to what the Label1 control is.Does anyone know how to do this? Heres my code: <asp:GridView ID="grid_sp_by_fac" runat="server" AllowPaging="True" AllowSorting="True"AutoGenerateColumns="False" CellPadding="4" DataKeyNames="id" DataSourceID="grid_update_speedcode"ForeColor="#333333" GridLines="None"><FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <Columns&...

Option Selection is lost in Grid when I postback , but I can get the option value (just selection point only lost)
hi All,I'm using option buttone (html control) in a Grid Which is working properly...If I postback the form by any other control my previous Selection is lost...I need to apper the selection after the form postback.PRabakar I guess you are using plain html controls, right?. Consider converting those to server side html controls by adding runat="server" to the declaration of the radio buttons. You will have to make sure viewstate of the grid is enabled CheersBug [MCSD]...

INSERT INTO statement....getting data from selected value from drop down list and text box.
Bellow is my code...I'm trying to get the value out of the drop down list (ddCategory) and the text box (txtTopic) and place it into the table ChapterDirectivesTopics. Could anyone tell me what i'm doing wrong is telling me the line that has mycommand.ExecuteNonQuery() Is not referenced to an object? I'm not sure what this means and need some help with it. Regards and thanks in advance. Ryan J Boyle Private Sub cmdSubmitTopic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmitTopic.Click ' Needs to be fixed...n...

Issue selecting selected value from drop down
Well basically what i have is three text boxes. The boxes are used as a sort feature. List3 is dependent on List1 and List2. These two lists set what values will be availbe to select in List3. What i am trying to do is pull the selected value from List3 as soon as its rendered and post the value into the page via JavaScript..Right now i have it working but its using a JavaScript timeout and i dont wanna do it with the timeout to pull the selected value...If i take out the timeouts it works but not initially...say i wanted "value0" in drpDownList3 well i would have to sele...

passing selected value from one gridview to the data source of another grid view.
i'm working with with c# i have two gridviews in the same page. in the first gridview i'm displaying departments. while clicking on a particular department name, i have to display details of employees in the second gridview. for that i have to pass the selected dept name to the sqldatasource of the second grid view. could u plz help me out to solve my problem?Tony J. Keeranchira have a look at this article  Vikram www.vikramlakhotia.comPlease mark the answer if it helped you SelectedIndex of the first wi...

need some feedback on using a multiview control that displays data in a formview control on the fourth view after making selections with radiobuttons on the previous views
I need some feedback on using a multiview control that displays data in a formview control on the fourth view after making selections with radiobuttons on the previous views. I am designing a webpage that allows the user to make certain selections with radio buttons that displays information about the selections on the last view but it seems the web page may be storing there selections in a cache or something because sometimes the last view wont change when I make a different selection with the radiobutton but for the most it changes upon selection but sometimes it wont view the changes...

using a drop down list to trigger a 'select' within a grid view control
Hi .Netters, Okay, so I wanted to have a gridview control containing a drop down list in each row - easy enough. But I am using it to replace a "select" command button that originally triggered a response.redirect() to another page. Now I want to offer a couple of different action that a user can perform when they select an option in the rows drop down list - for example each drop down list may contain the following actions: "Edit Details""Assign To Test""Delete User" Problem seems to be that the drop dpwn list will not trigger the select (row selected event), thus preventing me from usin...

2nd Data Grid Control
Hi, i have a DataGrid control on page that has a hyperlinked field.  When you click on the hyperlink the page opens, and returns the selected information from the database as it is supposed to.  However, I wanted to put another dataGrid on the hyperlinked page that pulls up more information about the hyperlinked item.  I tried this SQL statement but it returns all the rows of the database, when in actuality all i want it the second dataGrid to show certain columns from a different DB table.   SELECT     tbllog.IttNumber, tbllog.IttLog, tbllog.Lo...

DIsplay a selected item in the Details View when the Select link is click in the Grid View
HI, I have a Grid Vew that contains data bound, templete field and a Select column. When i click the Select column in the Grid View, I want the selected item details been display in the Details View. The details of the selected item is able to display in the Details View but when I select a new item from the Grid View, the Details View content would not refresh(showing the previous selected item details). The Details View contains databound, template field and Edit, Update and Cancel link. Grid View ---------- Product ID | Product Name | Qty | Price | Amount | Discou...

How to get row selected in Gridview and then to get the data from the cells in that Grid?
I have a gridview with about 30 rows of data. If someone selects a row in the grid(Clicking or double clicking) then I want to get the values in each column/cell in that row. Once I get those values, I want to populate other edit controls on my web form with the values selected from the row. So the big question here, is how to capture the row selected from clicking or double clicking. Then how to get the column cell items?   Clickable GridView Row

Web resources about - getting selected data in grid view according to the selected value in drop down -

Sonatype Snares $30 Million Investment Led By Goldman Sachs
Sonatype, a company that helps customers create automated, policy-driven software component security, announced a $30 million round today led ...

Run-DMC to open for Chili Peppers at pre-Super Bowl concert
ATLANTA (AP) — Run-DMC will open up for the Red Hot Chili Peppers at a pre-Super Bowl concert in San Francisco.

Trump on Obama: 'Maybe he feels comfortable' at mosque Trump on Obama: 'Maybe he feels comfortable' at mosque Donald Trump revived questions of President Barack Obama's religion ...

US Reports First Case Of Zika Virus Contracted Through Sexual Intercourse
The Zika Virus, a virus that is known to be carried by daytime Aedes mosquitoes and has slowly spread in several countries worldwide, has made ...

Hell, yeah, Amazon should open more bookstores
There is collective head-scratching across the InterWebs about a Wall Street Journal report that Amazon will open as many as 300, or even 400, ...

Google Will Now Warn You About Sites With Fake "Download" Buttons
Finding the right download button on a website is the least fun version of hide and seek ever invented. Now, Google’s taking action to warn users ...

UK says it will arrest Julian Assange even if UN rules in his favor
WikiLeaks founder Julian Assange says he will "accept arrest by British police" tomorrow if a UN panel rules that he has not been detained illegally ...

At CBS, Sumner Redstone is out and Les Moonves is in
CBS announced today that ailing and aging media mogul Sumner M. Redstone, who is 92, has resigned as the company's executive chairman. Leslie ...

Cisco-Jasper deal should make enterprise IoT safer
Cisco Systems' planned $1.4 billion acquisition of Jasper Technologies could make it easier for enterprises to build businesses around services ...

Toyota Ends Scion Brand – Why Did The Japanese Automaker Kill The Millennial/Hipster Brand?
Toyota has decided to end the Scion brand. The Japanese automaker indicated that the brand’s target audience, the millennial or hipster generation, ...

Resources last updated: 2/4/2016 1:14:06 PM