Forum


HomeHomePremiumPremiumDevelopmentDevelopmentPassing Variables in dnnModal.show()Passing Variables in dnnModal.show()
Previous
 
Next
New Post
4/1/2015 11:40 AM
 

Hello,

Here's my working code:

Highlighted is the text I'm passing to my Modal it looks like this:

How do I force a variable instead of hard coded data to my modal? I've tried everything from calling a function '<%#GetData()%>' to passing a literal  '<%#litData.Text%>'  and nothing works...

Thanks.

 
New Post
4/1/2015 3:37 PM
Accepted Answer 

Michael,

Since it's a server control, why don't you set it in the Page_Load event in the codebehind:

string param = Server.UrlEncode("1010011123-00");
HyperLink2.Attributes.Add("onclick", String.Format("return dnnModal.show('{0}?parameter={1}&popup=true',true,{2},{3},false);", "/askaquestion.aspx", param, 350, 800));

That should give you the control you need to inject the value from a module setting, user input, or querystring.

 
New Post
4/2/2015 7:31 AM
 

Scott,

Thanks for the help it appears to be mostly working. I can see from my debug that the value is passed and retrieved by my popup module correctly. The problem is that for some reason the popup immediately closes after retrieving the data... There doesn't seem to be a difference between the new dnnModal call and how I was doing it before. My code so far:

Button in view:

Your code:

My button is empty:

Any ideas?

Thanks again!

 
New Post
4/6/2015 5:24 AM
 

Michael,

Not sure about the behavior you are experiencing.  Take a look at this article which explains the dnnModal js function in a little more detail.  Maybe you can call a custom function from your onclick that wraps the dnnModal call and debug that in Firebug to see if anything strange is happening.

 
New Post
4/16/2015 9:18 AM
 

I had completely given up on getting this to work but I think I stumbled on what I did wrong:

I changed two things: I capitalized the 'U' in 'popUp' and added 'false' to the end. I also enclosed the string in its own variable so I could double check its contents. On a side note using server.UrlEncode was causing some weird results so I removed it from 'param'. The only problem now is that it causes the page to post back which I don't want even though I specified false for the 5th argument from that link you gave me. Rather irritating issue to fix. Thanks for the help. Let me know if you have any thoughts about how to stop that post back / refresh.

Thanks.

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentPassing Variables in dnnModal.show()Passing Variables in dnnModal.show()



Try FREE
30 days money back guaranteed