LINQ
http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
Split Comma Separated String and Filter
if (Session["_sTagno"] != null)
{
string ss = Session["_sTagno"].ToString();
var list = ss.Split(',').Where(s => !string.IsNullOrEmpty(s) && s != lblTagNo.Text).Distinct().ToArray();
string res = String.Join(",", list);
Session["_sTagno"] = res;
}
ORM
http://codetunnel.com/blog/post/introduction-to-entity-framework-part-i-object-relational-mapping
passing multiple command Arguments To Obout Grid (Client Side)
CommandArgument='<%# Container.DataItem["RefNo"]+","+ Container.DataItem["EntNo"] %>'
Find The button inside Template Obout Grid (Server Side)
Button View = (Button)grdReqPurchaseHistory.Templates[0].Container.FindControl("View");
Passing Arguments On Button Click (Client Side)
onclick='<%# String.Format("setGridInEditMode({0});", Container.DataItem["RefNo"] ) %>'
<script type="text/javascript">
function setGridInEditMode(rec) {
alert(rec);
}
</script>
On Row Click Of Grid
<OboutGrid:GridTemplate runat="server" ID="GtRow1">
<Template>
<table>
<tr onclick="RefreshDataGrid1(this)" id='<%#String.Format("{0},{1}",Container.DataItem["ItemTrnLineID"],Container.DataItem["OrderNo"]) %>'
style="cursor: pointer">
<td>
<%# Container.DataItem["refNo"]%>
</td>
</tr>
</table>
</Template>
</OboutGrid:GridTemplate>
<OboutGrid:Column DataField="refNo" HeaderAlign="left" Align="left" Width="10%" HeaderText="Ref Nos">
<TemplateSettings TemplateId="GtRow1" />
</OboutGrid:Column>
java Script
function RefreshDataGrid1(a) {
document.getElementById("ctl00_contentHolder_hfItemTrans").value = a.id;
$get('ctl00_contentHolder_btnEdit').click();
}
<div style="display: none">
<asp:Button runat="server" ID="btnEdit" OnClick="btnEdit_Click" />
</div>
protected void btnEdit_Click(object sender, EventArgs e)
{
str = hfItemTrans.Value.ToString().Split(',');
// BindBrandGridView(Convert.ToInt32(str[0]), "", "", "", true, false);
//BindGrid
}
Split Comma Separated String and Filter
if (Session["_sTagno"] != null)
{
string ss = Session["_sTagno"].ToString();
var list = ss.Split(',').Where(s => !string.IsNullOrEmpty(s) && s != lblTagNo.Text).Distinct().ToArray();
string res = String.Join(",", list);
Session["_sTagno"] = res;
}
ORM
http://codetunnel.com/blog/post/introduction-to-entity-framework-part-i-object-relational-mapping
passing multiple command Arguments To Obout Grid (Client Side)
CommandArgument='<%# Container.DataItem["RefNo"]+","+ Container.DataItem["EntNo"] %>'
Find The button inside Template Obout Grid (Server Side)
Button View = (Button)grdReqPurchaseHistory.Templates[0].Container.FindControl("View");
Passing Arguments On Button Click (Client Side)
onclick='<%# String.Format("setGridInEditMode({0});", Container.DataItem["RefNo"] ) %>'
<script type="text/javascript">
function setGridInEditMode(rec) {
alert(rec);
}
</script>
On Row Click Of Grid
<OboutGrid:GridTemplate runat="server" ID="GtRow1">
<Template>
<table>
<tr onclick="RefreshDataGrid1(this)" id='<%#String.Format("{0},{1}",Container.DataItem["ItemTrnLineID"],Container.DataItem["OrderNo"]) %>'
style="cursor: pointer">
<td>
<%# Container.DataItem["refNo"]%>
</td>
</tr>
</table>
</Template>
</OboutGrid:GridTemplate>
<OboutGrid:Column DataField="refNo" HeaderAlign="left" Align="left" Width="10%" HeaderText="Ref Nos">
<TemplateSettings TemplateId="GtRow1" />
</OboutGrid:Column>
java Script
function RefreshDataGrid1(a) {
document.getElementById("ctl00_contentHolder_hfItemTrans").value = a.id;
$get('ctl00_contentHolder_btnEdit').click();
}
<div style="display: none">
<asp:Button runat="server" ID="btnEdit" OnClick="btnEdit_Click" />
</div>
protected void btnEdit_Click(object sender, EventArgs e)
{
str = hfItemTrans.Value.ToString().Split(',');
// BindBrandGridView(Convert.ToInt32(str[0]), "", "", "", true, false);
//BindGrid
}
Linq
Select Columns from DataTable in Linq
var query = DataTable_Name.AsEnumerable().Select
(r => new
{
ColName1 = r.Field<string>("ColName1"),
ColName2 = r.Field<int>("ColName2"),
}).ToList();
(r => new
{
ColName1 = r.Field<string>("ColName1"),
ColName2 = r.Field<int>("ColName2"),
}).ToList();
ddlRiskLevels.DataSource = query;
ddlRiskLevels.DataBind();
No comments:
Post a Comment