CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > starter_kits_and_source_projects.dotnetnuke.custom_modules Tags:
Item Type: Date Entered: 9/6/2005 3:28:34 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 31 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"AlexandruS" <>
NewsGroup User
Problem with codebehind functions9/6/2005 3:28:34 PM

0

Hey guys,

I want to develop a custom module for dotnetnuke in C#. Everything is super ok so far except for one problem:
In the ascx View control for my module, I use a Datalist for the layout. In the ascx file I need to call a function in the dll module like the DataBinder.Eval (Container.DataItem, "Val") function whichworks great. However, I need to call one of my functions like GetImageUrl(DataBinder.Eval (Container.DataItem, "Image")). The GetImageUrl is a public function in ModuleName.ascx.cs file.
 
When I insert <%#GetImageUrl(DataBinder.Eval (Container.DataItem, "Image")) %> in the ascx file a :

DotNetNuke.Services.Exceptions.ModuleLoadException: External component has thrown an exception. ---> System.Web.HttpException: External component has thrown an exception. ---> System.Web.HttpCompileException: External component has thrown an exception. at System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Compilation.BaseCompiler.GetCompiledType() at System.Web.UI.UserControlParser.CompileIntoType() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation().

exception is thrown at runtime. I saw lots of functions in the other modules that are called form the ascx file and of course there is no problem there.
I don't know what to do, is there a problem with C#?

Thank you!
Alex
"AlexandruS" <>
NewsGroup User
Re: Problem with codebehind functions9/6/2005 6:42:49 PM

0

Problem solved.

The GetImageUrl function signature was:  public string GetImageUrl(string relativePath)

However,
DataBinder.Eval (Container.DataItem, "Image") was passing the result to GetImageUrl as an object instead of a string hence the weird compile exception.
 
I've change the GetImageUrl to take the parameter as an object : public string GetImageUrl(object relativePath) and it's working now.
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:













create new textbox dynamically on button destroys viewstate and doesn't add! :(

html server control and web controls

http “200 ok”

how to get the frames attributes..

error running debugger for c#.net

remoote image properties

problem in mozilla

validationgroup

hidden fields.....

how to preserve page position?

regarding pop up window

a calendar date problem: string was not recognized as a valid datetime.

webform oop question

how to create automated characters/numbers to prevent bots filling form?

how to clear textbox value

types of httprequests

search page

system.web.mail driving me insane

menu setup

how to show a control in front of another

input type="file" validation

<img button > tages not closed

radiobuttonlist unselect

number of data connection per page question

e-mail form problem

problems with placing dropdownlist values in a lis

sending email help?

how to dispay news articles?

faxing from an aspx page

static classes in web site scope

how to add a text box and checkbox to an aspx file programatically?

can anyone tell me how to access client side contorls

dont trigger postback, is it possible?

pdf in new window load problem

radio buttons: autopostback never called when default radio button clicked.

url rewrites on a non-existing directory

creating child elements in an ascx control

why does this customdatacontrol field only render in the last row of the gridview?

adding text/controls to a calendar control day

ascx value into aspx page

email an update

variables not storing data from one page to another

buttonclick event is not being fired in ie

creating <ul> dynamically from code behind.

display default value in data-driven dropdown?

newbie to thread

how to access value from html texbox in my asp.net page

pass querystring without redirecting

programatically add filteredtextboxextender

where can i find all the events and properties specifications for the login control?

   
  Privacy | Contact Us
All Times Are GMT