Click here to Skip to main content
15,909,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
i have created asp.net table and bind it with database table. it has four colms and 1 dropdown.
now after getting data from database asp.net table has shown 5 results.
what i want is that if user change dorpdown values in the 3 row, it should get all the cells values of that 3rd row.
how can i do that.
Please help me out
Thanks
Posted
Comments
Hemant Singh Rautela 5-Sep-14 4:02am    
Your Code... !

asp.net Table is not data control. I think you are talking about asp:GridView

you can use onselectedindexchanged event in dropdown and then get the corresponding gridview row index like this
C#
DropDownList ddl = (DropDownList)sender;
GridViewRow row = (GridViewRow)ddl.Parent.Parent;
int idx = row.RowIndex;

Source From here>>

and some more examples
How to fire Gridview dropdownlist selected index changed
Raising DropDownList SelectedIndexChanged From GridView Control
 
Share this answer
 
v2
Comments
saifullahiit 5-Sep-14 4:45am    
<asp:table runat="server">
m talking about this table
Dilan Shaminda 5-Sep-14 4:59am    
i mean you can't directly bind data to <asp:Table> it does not contain property for binding data.May be you have put it inside a controller like repeater
jQuery:
JavaScript
function cbo_selectedIndexChanged() {
var row = $(this).closest("tr");

//you get whole row, you can access td values via 
//row.cells collection
$.each(this.cells, function(){
        alert('hello, I am the cell'); 
    });

//OR
$('td', this).each(function() {
        alert('hello, I am the cell'); 
});

}


If this solves your problem, please accept it as a solution so you make it easier for others. Thank you
 
Share this answer
 
Comments
saifullahiit 5-Sep-14 4:45am    
i want asp.net code behind solution bro
Sinisa Hajnal 5-Sep-14 5:44am    
Then use either asp:GridView or asp:Repeater...

You can use the above solution to call your server side through ajax giving it rowindex or identification field (example: customer_id from customers table) as parameter and then using that to get the fields.

I cannot write your code, I don't know the details of your setup. And even if I did, I wouldn't write it. YOU should write your code, that is the way of learning. Otherwise, pay someone to do it for you and don't bother with programming.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900