简体   繁体   中英

How to call ascx function code behind using javascript? DotNetNuke

I have a module with code behind that submits data to a SQL table in a database. I do my validation with javascript and I show a div when a button is clicked and data is valid. The problem having is when I do a postback to the server my window/browser refreshes. I would like to Post data to the server and show my div. So I think I need use ajax...problem is I am unfamilar with ajax's. My method that submits data to the database is in a dotnetnuke module/user control (ascx file). Can anyone provide some direction?

In DNN you can simply mark your ASCX file as "Supports Partial Rendering" and DNN will wrap it in an UpdatePanel, this is the easiest way to achieve the post back without the full page refreshing.

You can do this by modifying you .DNN file before installation, or after installation, going to the host/extensions page, edit the module, edit the Module definition, then edit the Module control in question.

Edit:In the DNN file you can have

<moduleControl>
<controlKey />
<controlSrc>DesktopModules/$safeprojectname$/View.ascx</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle />
<controlType>View</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM