when i retreiving 0 in dropdownlist then error is coming
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
</style><asp:GridView ID="GridView1" runat="server" AutoGenerateSelectButton="false" AutoGenerateColumns="false" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" Height="229px" style="margin-bottom: 53px" Width="1055px" OnRowDataBound="GridView1_RowDataBound" OnRowUpdating="GridView1_RowUpdating" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<AlternatingRowStyle BackColor="#F7F7F7" />
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<SortedAscendingCellStyle BackColor="#F4F4FD" />
<SortedAscendingHeaderStyle BackColor="#5A4C9D" />
<SortedDescendingCellStyle BackColor="#D8D8F0" />
<SortedDescendingHeaderStyle BackColor="#3E3277" />
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" Visible="True" />
<asp:TemplateField HeaderText="Date">
<ItemTemplate>
<asp:Label ID="Date" runat="server" Text='<%#Bind("Date")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Head">
<ItemTemplate>
<asp:Label ID="Head" runat="server" Text='<%#Bind("Head")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cheque_No" >
<ItemTemplate>
<asp:Label ID="Cheque_No" runat="server" Text='<%#Bind("Cheque_No")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cheque_Date">
<ItemTemplate>
<asp:Label ID="Cheque_Date" runat="server" Text='<%#Bind("Cheque_Date")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cheque_Bank">
<ItemTemplate>
<asp:Label ID="Cheque_Bank" runat="server" Text='<%#Bind("Cheque_Bank")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cheque_Branch">
<ItemTemplate>
<asp:Label ID="Cheque_Branch" runat="server" Text='<%#Bind("Cheque_Branch")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="Amount" CssClass="right_align" ItemStyle-HorizontalAlign="Right" runat="server" Text='<%#Bind("Amount")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="link" ItemStyle-HorizontalAlign="Center" ControlStyle-ForeColor="Blue " ControlStyle-Height="20px" ShowSelectButton="true" SelectText="Transfer" >
<ControlStyle ForeColor="Blue" Height="20px" />
</asp:CommandField>
<asp:TemplateField HeaderText="Bank" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="lbbank" runat="server" />
<asp:DropDownList ID="ddlbank" runat="server" Text='<%#Bind("ddlbank")%>' Height="85px" Width="150px">
<asp:ListItem Text="Select" value="0" />
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
ALTER Proc [dbo].[Sp_Ret_Transection_CHeq]
as begin
SELECT T.Trans_ID as ID,COnvert(varchar,T.Trans_Date,101) as Date,COA.Level_Four_Name as Head,T.Cheque_No ,
Convert(varchar,T.Cheque_Date,101) as Cheque_Date,T.Cheque_Bank,T.Cheque_Branch,'0' as ddlbank
-- REPLACE(CONVERT(varchar(20),cast(T.Trans_Amount as money))) as Amount
,(CONVERT(varchar(50), CAST(t.Trans_Amount AS money),1)) as Amount,T.Cheque_Status
FROM tbl_transection T
inner join tbl_COA COA on COA.Level_Four_ID=T.Level_Four_ID_C
where T.Trans_Type_ID=2 and T.Cheque_Status is null
end
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlbank = (DropDownList)e.Row.FindControl("ddlbank");
SqlCommand cmd = new SqlCommand("select Level_Four_ID,Level_Four_Name from tbl_COA where Level_Three_ID=3102 ", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
ddlbank.DataSource = dt;
ddlbank.DataTextField = "Level_Four_Name";
ddlbank.DataValueField = "Level_Four_ID";
ddlbank.DataBind();
ddlbank.Items.Insert(0, new ListItem("--Select Bank--", "0"));
}
}