filtering rows in dataset...

Posted by Divs99 under C# on 6/6/2012 | Points: 10 | Views : 18950 | Status : [Member] | Replies : 5
DataRow[] oRows = null;

_DSFoot = (DataSet)ViewState["Foot"];--here iam getting all rows with client and partnership level ..now i want to filter rows in dataset




switch (Convert.ToInt32(RbLstFneLevel.SelectedValue))

{

case 0:
oRows = _DSFootnotes.Tables[

"Table"].Select("FootLevel_ID = " + (Int32)Constants.FOOTNOTELEVELS.Partnership);

break;


case 1:

oRows = _DSFootnotes.Tables["Table"].Select("FootLevel_ID = " + (Int32)Constants.FOOTNOTELEVELS.Client);


break;

default:


break;

}

_DSFootnotes.Tables["Table"].AcceptChanges();


i want to filter rows with partnership level in dataset and bind to repeater....




Responses

Posted by: Svandanapu on: 6/6/2012 [Member] Starter | Points: 25

Up
0
Down
Use LINQ

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

Posted by: perfectchourasia-9163 on: 6/8/2012 [Member] Starter | Points: 25

Up
0
Down
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet dt = DAL.ExecuteDataset("Server=.;uid=sa;pwd=sa123;database=Enigma", CommandType.Text, "select * from dbo.UserDetail");
if (dt != null)
{
DataView dv = dt.Tables[0].DefaultView;
dv.RowFilter = "Address1 like '%Japan%' and Address2='Developing'";
dv.Sort = "Address2 desc";
lbldata.DataSource = dv;
lbldata.DataBind();
}
}
}

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

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

Posted by: Saclines on: 8/22/2014 [Member] Starter | Points: 25

Up
0
Down
Use of LINQ will make it easy
REFER : http://www.dotnetlines.com/forum/tabid/86/forumid/2/threadid/277/scope/posts/Default.aspx

Sachin N. S.

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

Posted by: Saclines on: 8/22/2014 [Member] Starter | Points: 25

Up
0
Down
LINQ will be easier
http://www.dotnetlines.com/forum/tabid/86/forumid/2/threadid/277/scope/posts/Default.aspx

Sachin N. S.

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

Posted by: Naveenhcl on: 9/3/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

If you want to filter DataSet data then better to go with DataView for filter.

Ex:
DataSet ds=//data;
DataView dv=ds.Tables[0].DefaultView;
dv.RowFilter="col1=123";
Gv.DataSource=dv;
Gv.DataBind();


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

Login to post response