Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Wednesday, March 28, 2012

Progess bar for a fileupload in an iFrame

hi,

I have put a file upload control in an iFrame so that I can mimic an asynch. postback. This works well, but now I would like to be able to detect when the button in the iFrame that submits the form in the iframe is clicked, so that i can trigger a "processing" message in the main page, which isn't posting back.

Any ideas on how I might accomplish this? (or if anyone has a better way to do an asynchrounous fileupload I'm very open to suggestions :-)

Hmm... I would be very interested in the direction you are headed.

Couldn't you do something with the onclientclick of the submit button in the iframe? So when that submit button is clicked in the iframe, a javascript is fired in the parent/main page that shows a "processing" message.

http://www.esqsoft.com/javascript_examples/iframe_talks_to_parent/

I am trying to do the exact same thing, would you have any example code?

thanks..

Programmatic equivalent to System.Web.UI.ScriptResource attribute?

Is there a programmatic equivalent to the following attribute normally put in the AssemblyInfo file in a class library project?

<Assembly: System.Web.UI.ScriptResource("LocalizedControl.TravelInfo.js", "LocalizedControl.TravelResources", "Travel")>

I would like to use reflection to do this programmatically w/o having to link in System.Web.Extensions.

I can use ScriptManager.RegisterClientScriptResource()

to do the equivalent of

<Assembly: System.Web.UI.WebResource("LocalizedControl.TravelInfo.js", "application/x-javascript")>

but have not found a way to do the equivalent of the ScriptResource attribute.

Thanks,
Chris

Hi cpels,

Hope this will helps.

To specify how resource files are managed when an assembly is built, you include attributes in the AssemblyInfo file (AssemblyInfo.vb or AssemblyInfo.cs file).

In ASP.NET, you mark resources for the application by using theWebResourceAttribute class. To embed JavaScript files in an assembly, you use this attribute to specify the .js files as a Web resource.

To include resource files for the embedded JavaScript files, you use theScriptResourceAttribute class that is provided by ASP.NET AJAX. This attribute identifies the files specifically as resources for the JavaScript files.

The following example shows how to use assembly attributes to identify embedded scripts and their associated script resources.

' Indicates that neutral fallback resources are retrieved from ' the main assembly named MainAssembly.<assembly: NeutralResourcesLanguageAttribute("en-US", UltimateResourceFallbackLocation.MainAssembly)>' Defines embedded scripts as Web resources.<assembly:WebResource("Sample.js", "text/javascript")><assembly:WebResource("Sample.debug.js", "text/javascript")>' Defines the script resources for the scripts and their types.<assembly:ScriptResource("Sample.js", "Sample.resources", "Sample.Res")><assembly:ScriptResource("Sample.debug.js", "Sample.debug.resources", "Sample.Res")>

// Indicates that neutral fallback resources are retrieved from // the main assembly named MainAssembly.[assembly: NeutralResourcesLanguageAttribute("en-US", UltimateResourceFallbackLocation.MainAssembly)]// Defines embedded scripts as Web resources.[assembly:WebResource("Sample.js", "text/javascript")][assembly:WebResource("Sample.debug.js", "text/javascript")]// Defines the script resources for the scripts and their types.[assembly:ScriptResource("Sample.js", "Sample.resources", "Sample.Res")][assembly:ScriptResource("Sample.debug.js", "Sample.debug.resources", "Sample.Res")]
 

In this example, a main assembly namedMainAssembly contains an embedded release version of a client script file that is named Sample.js. The assembly also contains the corresponding debug version named Sample.debug.js. The .js files are identified as resources by theWebResourceAttribute attribute.

TheNeutralResourcesLanguageAttribute assembly attribute is used to specify the main assembly as the fallback culture. For more information, seeNeutral Resources Languages for Localization and theNeutralResourcesLanguageAttribute class overview.

The resources used by the script files are defined by using theScriptResourceAttribute attribute. The Sample.resources and Sample.debug.resources files contain resource values for the Sample.js and Sample.debug.js files, respectively.

A type named Sample.Res is generated for both the release and the debug version of the script resources. This is the type that the JavaScript code should use to access localized values. For both release mode and debug mode, the build process creates only a single type. In debug mode the resources for the release version are combined with the additional resources for the debug version.

For more information about how to create assembly-information files and the assembly metadata that is required for versioned assemblies, seeHow to: Create Versioned Assemblies for Precompiled Web Sites.

http://ajax.asp.net/docs/overview/LocalizingResources.aspx
If I misunderstood you,please let me know.
 


I am familiar with how to use the ScriptResourceAttribute in an assembly. However, this requires that the System.Web.Extensions assembly be referenced in the assembly that I am building. What I want to do is NOT have my assembly reference System.Web.Extensions, but rather use reflection to invoke various aspects of MSFT AJAX so there is no dependency on having AJAX installed. This allows my user control in the assembly to work on systems that are not using AJAX if necessary.

I have been able to implement all aspects of my MSFT AJAX functionality this way except the ScriptResourceAttribute. The ScriptManager class has the RegisterClientScriptResource() method. However, the ScriptManager class does not have a method for associating a resource with a client script the way the ScriptResourceAttribute does.

Chris

Saturday, March 24, 2012

Question about adding data to a databse (Im new to Atlas)

I'm wondering how I use Atlas to dynamically add data to a database using the default.aspx.cs file and not a web service. Any help is appreciated.

hello.

well, you have 2 options (one sucks more that the other :D):

1. use page method

2. use an updatepanel.

Wednesday, March 21, 2012

Question regarding Text for CollapsiblePanel Control

Is it possible to have the displayed output of the CollapsiblePanel come from a text file or some other source? I have a file that contains some disclaimer information that I'd like to display, but it is in a text format and is about a page and a half. Is my only option to convert the text to html and then embed all of it within the control?

Would this be an appropriate control to use for this? I would if possible rather not have to display a separate .aspx page to display this information.

Hi,

You can add a iframe in the panel, set its src to the txt file directly. For instance:

<iframesrc="TextFile.txt"></iframe>

Hope this helps.


Thank you Raymond that worked great. I also discovered another way by creating a Custom Web Control and populating it with the text to be displayed. I then drop the Custom Control in my Content CollasiblePanel and surround it with a div tag to control the height, overflow, and background color.