Monday, September 26, 2011

Binding Grid View,Drop down with in grid view from aspx page

//Drop Down In Item template
//Test .aspx
<asp:DropDownList ID="ddlCreditClient" runat="server" Visible="true" DataSource='<%#BindCreditClient()%>'    DataTextField="CName" DataValueField="ClientId">

//Test.aspx.cs
protected DataTable BindCreditClient()
    {
        DataTable dt = new DataTable();
        //bind data table here
        return dt;
    }


 //Data List  in Item template
//Test.aspx
 <asp:DataList ID="DlInnerWorkFlow" runat="server" RepeatDirection="Horizontal" DataSource='<%#getWorkFlowForm(Convert.ToInt32(Eval("FormId")),(Convert.ToInt32(Eval("DepartmentID"))))%>'>
 <ItemTemplate>
 <asp:Label ID="lblUserName" runat="server" BorderStyle="None" Text='<%#Eval("FirstName")%>'></asp:Label>
</ItemTemplate>
 <SeparatorTemplate>
 <asp:Image ID="imgarrow" runat="server" ImageAlign="Bottom" BorderStyle="None" ImageUrl="~/images/btn-arrow_right_Gray.gif" />
 </SeparatorTemplate>
 </asp:DataList>


//Test.aspx.cs

  public DataTable getWorkFlowForm(int FormId, int DepartmentId)
    {
      
        DataTable dt = new DataTable();
      //bind datatable here
          
        return dt;
    }



No comments:

Post a Comment