I am using GridView control for uploading files I am uploading using RowCommand Event, My scenario is like this
1: User login and comes to the page and upload file
2: User login, enter some data and save it,post back will occur and data will be shown in Grid.
The Upload functionality is working fine in scenario 1, however its not working after scenario 2
This is my Code
<asp:GridView ID="GVUsers" runat="server" OnRowDataBound="GVUsers_RowDataBound" OnRowCommand="GVUsers_RowCommand"
OnRowDeleting="GVUsers_RowDeleting" AutoGenerateColumns="false" CssClass="table">
<Columns>
<asp:TemplateField HeaderText="Files" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:FileUpload ID="filedoc" runat="server" Width="98%" CssClass="filedoc" />
<asp:Button ID="btnuploadfiles" runat="server" CommandName="fileupd" Text="Upload"
CssClas="uploadbtn" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void GVUsers_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "fileupd")
{
//Upload File
}
}
and this is how I am databinding
if(!Page.IsPostBack)
{
}
I also tried binding grid after the above condition,ie Binding Grid always,but no Luck
I tried assinging event handler from code behind,but same issue.
How can I make RowCommand Working after post back?