file upload in gv in asp.net
-
sallam 2 all; tat is my code <asp:Button ID="btnCaseDetailsAttach" runat="server" Text="Attach" CssClass="ButtonBlackCss" OnClientClick="return triggerFileUpload();" onclick="btnCaseDetailsAttach_Click" /> <asp:Button ID="btnCaseDetailsDetachFile" runat="server" Text="Detach File" CssClass="ButtonBlackCss" onclick="btnCaseDetailsAttach_Click"/> <asp:HiddenField id="pathpicker" runat="server" /> <input type="file" id="File1" style="visibility:hidden;" onchange="LoadPath();" /> <asp:Label ID="lblSendMail" runat="server"></asp:Label> <asp:GridView ID="gvCaseDetailsWebFileName" runat="server" CssClass="hor-minimalist-c" Enabled="false"> </asp:GridView> <script type="text/javascript"language="javascript"> function triggerFileUpload() { document.getElementById("File1").click(); } function LoadPath() { var a=document.getElementById("File1").value; alert(a); document.getElementById("<%=pathpicker.ClientID%>").value=a; alert(document.getElementById("<%=pathpicker.ClientID%>").value); return true; } </script> on attach btn gvCaseDetailsWebFileName.DataSource = null; gvCaseDetailsWebFileName.Visible = false; string value = pathpicker.Value; objCaseGeneration.FilePath(value.ToString()); gvCaseDetailsWebFileName.DataSource = objCaseGeneration.dsMissingDateOfServices.Tables["CaseGeneration"]; gvCaseDetailsWebFileName.DataBind(); gvCaseDetailsWebFileName.Visible = true; tis code only browses files bt not works and not places file name in gridview n tis browses in internet xplorer not in mozilla y?
-
sallam 2 all; tat is my code <asp:Button ID="btnCaseDetailsAttach" runat="server" Text="Attach" CssClass="ButtonBlackCss" OnClientClick="return triggerFileUpload();" onclick="btnCaseDetailsAttach_Click" /> <asp:Button ID="btnCaseDetailsDetachFile" runat="server" Text="Detach File" CssClass="ButtonBlackCss" onclick="btnCaseDetailsAttach_Click"/> <asp:HiddenField id="pathpicker" runat="server" /> <input type="file" id="File1" style="visibility:hidden;" onchange="LoadPath();" /> <asp:Label ID="lblSendMail" runat="server"></asp:Label> <asp:GridView ID="gvCaseDetailsWebFileName" runat="server" CssClass="hor-minimalist-c" Enabled="false"> </asp:GridView> <script type="text/javascript"language="javascript"> function triggerFileUpload() { document.getElementById("File1").click(); } function LoadPath() { var a=document.getElementById("File1").value; alert(a); document.getElementById("<%=pathpicker.ClientID%>").value=a; alert(document.getElementById("<%=pathpicker.ClientID%>").value); return true; } </script> on attach btn gvCaseDetailsWebFileName.DataSource = null; gvCaseDetailsWebFileName.Visible = false; string value = pathpicker.Value; objCaseGeneration.FilePath(value.ToString()); gvCaseDetailsWebFileName.DataSource = objCaseGeneration.dsMissingDateOfServices.Tables["CaseGeneration"]; gvCaseDetailsWebFileName.DataBind(); gvCaseDetailsWebFileName.Visible = true; tis code only browses files bt not works and not places file name in gridview n tis browses in internet xplorer not in mozilla y?
I think there is some problem in your javascript, that is why it is not showing browse in internet explorer not in mozilla. You need to check the error console of mozilla to track what is the problem Just go to Tools>Error Console in mozilla or press Ctrl+Shift+J. And the grid is also not binding because of the same problem. HTH
Jinal Desai - LIVE Experience is mother of sage....
-
I think there is some problem in your javascript, that is why it is not showing browse in internet explorer not in mozilla. You need to check the error console of mozilla to track what is the problem Just go to Tools>Error Console in mozilla or press Ctrl+Shift+J. And the grid is also not binding because of the same problem. HTH
Jinal Desai - LIVE Experience is mother of sage....
-
te error is on tis line of code document.getElementById bt what should be tere i hav no idea
inputFile.click() not support for Mozilla. Check this Link[^]
Raju.M
-
sallam 2 all; tat is my code <asp:Button ID="btnCaseDetailsAttach" runat="server" Text="Attach" CssClass="ButtonBlackCss" OnClientClick="return triggerFileUpload();" onclick="btnCaseDetailsAttach_Click" /> <asp:Button ID="btnCaseDetailsDetachFile" runat="server" Text="Detach File" CssClass="ButtonBlackCss" onclick="btnCaseDetailsAttach_Click"/> <asp:HiddenField id="pathpicker" runat="server" /> <input type="file" id="File1" style="visibility:hidden;" onchange="LoadPath();" /> <asp:Label ID="lblSendMail" runat="server"></asp:Label> <asp:GridView ID="gvCaseDetailsWebFileName" runat="server" CssClass="hor-minimalist-c" Enabled="false"> </asp:GridView> <script type="text/javascript"language="javascript"> function triggerFileUpload() { document.getElementById("File1").click(); } function LoadPath() { var a=document.getElementById("File1").value; alert(a); document.getElementById("<%=pathpicker.ClientID%>").value=a; alert(document.getElementById("<%=pathpicker.ClientID%>").value); return true; } </script> on attach btn gvCaseDetailsWebFileName.DataSource = null; gvCaseDetailsWebFileName.Visible = false; string value = pathpicker.Value; objCaseGeneration.FilePath(value.ToString()); gvCaseDetailsWebFileName.DataSource = objCaseGeneration.dsMissingDateOfServices.Tables["CaseGeneration"]; gvCaseDetailsWebFileName.DataBind(); gvCaseDetailsWebFileName.Visible = true; tis code only browses files bt not works and not places file name in gridview n tis browses in internet xplorer not in mozilla y?