Row filter in dataview

Posted by Venkatesh under ASP.NET on 6/21/2011 | Points: 10 | Views : 12150 | Status : [Member] | Replies : 5
Hi,

i have a dataview which is having 10 records like

101 abcd
101 cdcf
102 jkl
103 jshdfj

...

so on row filter i want retrieve records of 101 i am passing 101 value.How to do this?

Thanks
Venkatesh.ponna




Responses

Posted by: Lakn2 on: 6/21/2011 [Member] Starter | Points: 25

Up
0
Down
do one thing place dropdownlist and bind your id values to dropdown and change autopostback=true and

dropdown1_onselectedindexchanged event get row values

sqldaadapter da=new sqldataadapter("select * from tname where id="+dropdownlist1.selectedvalue+"",cn);

..........



Thanks&Regards
LakshmiNarayana Nalluri.

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 6/21/2011 [Member] Starter | Points: 25

Up
0
Down
hi..just try this one ..
add one text box and button
in textbox enter the value you want to filter.
in Button click event enter this code.and bind the value into grid by passing the code
sqldaadapter da=new sqldataadapter("select * from table1 where id="+textbox1.text+"",con);

http://vbdotnetaddict.blogspot.com/

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Udaik on: 6/21/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

As you have a DataView, you are using the DataView.RowFilter expression I presume, the above requirement could be acheived as:
DataView.RowFilter = "ColumnName LIKE '101*'"

This will filter out the values beginning with 101. Note: Here ColumnName would be the DataView column name you are filtering

Hope this helps!

Regards,
Udai

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 6/22/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
DataView.RowFilter = "ColumnName ='101' "


Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 6/22/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
try like this

DataRow[] dr = dv.Table.Select("TblName='" + lbldName.Text.ToString() + "'");
syntax:DataRow[] dr=dv.Table.Select("Expression");

Also check the belowl ink

http://stackoverflow.com/questions/5752141/how-to-filter-a-dataview-from-the-ith-row-to-jth-row-c


Thanks
Karthik
www.f5Debug.net

Venkatesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response