i try to show documents specifically like hr admin only view hr documents and finance admin only view finance documents for this first i create a sp
alter procedure sphrdoc
@UserName nvarchar(50),
@Password nvarchar(50)
as
select DepID from Userss where UserName=@UserName AND [Password]=@Password
and
Session["a"] = dd.hrdoc(Convert.ToString(Session["Login2"]), (Convert.ToString(Session["Login3"])))
;
when admin user signup then his/her department id also save in userss table..
then i create a sp
create procedure sphrdocid1
@DepID int
as
select * from DocumentInfo where DepID=@DepID
and then i also a create a funtion
public int hrdoc(string Username,string password)
{
return Convert.ToInt32( db.ExecuteScalar("sphrdoc",new object[]{Username,password}));
}
public DataTable hrdoc1(int id)
{
return db.ExecuteDataSet("sphrdocid1",new object[]{id}).Tables[0];
}
and
GrdFileApprove.DataSource = dd.hrdoc1(Convert.ToInt32(Session["a"]));
GrdFileApprove.DataBind();
and gridview code is
<asp:GridView ID="GrdFileApprove" runat="server" BackColor="White"
BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4"
GridLines="Horizontal" AutoGenerateColumns="False"
onrowcommand="GrdFileApprove_RowCommand"
OnRowDataBound="OnRowDataBound"
onselectedindexchanged="GrdFileApprove_SelectedIndexChanged1" >
<Columns>
<asp:TemplateField HeaderText="S no">
<ItemTemplate>
<%# Container.DataItemIndex+1 %>
<asp:HiddenField runat="server" ID="HdnFileID" Value='<%# Eval("DocID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DocID" HeaderText="DocumentID" />
<asp:BoundField DataField="DocName" HeaderText="DocName" />
<asp:BoundField DataField="Uploadfile" HeaderText="File Name" />
<asp:BoundField DataField="DocType" HeaderText="Document" />
<asp:BoundField DataField="DepType" HeaderText="Department" />
<%-- <asp:BoundField HeaderText="ApproveID" DataField="ApproveID" ></asp:BoundField>
--%> <asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblCountry" runat="server" Text='<%# Eval("ApproveID") %>' Visible = "false" />
<asp:DropDownList ID="DropDownList4" runat="server" EnableViewState="true" class="vpb_dropdown" DataTextField="ApproveType" DataValueField="ApproveID" AutoPostBack="true" OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged">
<asp:ListItem Text="Pending" selected="selected" Value="3"></asp:ListItem>
<asp:ListItem Text="Approve" Value="1"></asp:ListItem>
<asp:ListItem Text="Reject" Value="2"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
but it shows me error in this line
GrdFileApprove.DataBind();
any solution?