<asp:TemplateField HeaderText="Organization">
<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Text='<%#GetORGName(Convert.ToString(DataBinder.Eval(Container.DataItem,
"org_id", ""))) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
public String GetORGName(string org_id)
{
if (org_id == null || org_id == "")
{
return "No Organization";
}
else
{
int org =
Convert.ToInt32(org_id);{
if (org_id == null || org_id == "")
{
return "No Organization";
}
else
{
string sql = "SELECT * FROM p2p_v2_registration WHERE org_id=" + org + "";
SqlDataAdapter ad = new SqlDataAdapter(sql, con);
DataTable dt = new DataTable();
ad.Fill(dt);
return
dt.Rows[0]["organization"]. ToString().Trim();
}
}
No comments:
Post a Comment