Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesfileuploadfileupload
Previous
 
Next
New Post
7/18/2013 7:26 AM
 

Dear members;

I want to use "asp:fileupload" and "asp:button" in my module. But after, I install the module and click upload button  I recieve below error:

Message: DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at ArianSQL.Control1.OnUploadClick(Object sender, EventArgs e) at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- 

for resolve this Error, I use "dnn:urlcontrol.ascx"  fileupload instead of the "asp:fileupload". But I can't access file id, file name and file content after uploading the file.

Please help me that how solve this error.

Thanks in advance.

 

 
New Post
7/19/2013 7:33 AM
 

I resolved my problem:

HTML SOURCE:

 <asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<asp:FileUpload runat="server" id="uplSqlScript" />
<asp:Button runat="server" id="btnSubmit" Text="Upload"
onclick="btnSubmit_Click" resourcekey="cmdUpload" EnableViewState="False" CssClass="dnnSecondaryAction" />
</ContentTemplate>
<Triggers>
<asp:postbacktrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>

And C# Sourec Code:

protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (uplSqlScript.HasFile)
{
if (!String.IsNullOrEmpty(uplSqlScript.PostedFile.FileName))
{
var scriptFile = new StreamReader(uplSqlScript.PostedFile.InputStream);
txtQuery.Text = scriptFile.ReadToEnd();
}
}
}
}

 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesfileuploadfileupload


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out