WebMatrix - Partial View Updates - partial

I have a simple default page that renders 3 different content pages.
<div style=" float:left;">
#RenderPage("/Content/AddCounty.cshtml")
</div>
<div style=" float:left;width:300px;">
#RenderPage("/Content/AddTown.cshtml")
</div>
<div style=" float:none;width:300px;">
#RenderPage("/Content/AddCompany.cshtml")
</div>
These pages have kind of same fields like id, text_name.
All of them have forms in it with Post method and submit button.
how to achieve partial update as we used to do in asp.net ?
your help will be appreciated.
Thanks,
Talha

Use jQuery to post the form values and update the DOM. Have a look at the jQuery Post API

Related

Set value to the "preheader" of a design in sendgrid API

I am using SendGrid API to create/update/delete a Design.
as you can see in the picture below, there isn't any JSON item to set the value for the "preheader"
So after creating successfully in the Sendgrid design library the preheader is empty and we should fill it by editing the design. picture below
Is there any solution to set the value to the preheader with API?
I find the solution. As Philnash has mentioned in this post the pre-header is located in the body of the Email Design Html. But we should use some attributes which are very important.
Just append these 2 nested div with a p tag to the body of your Html-content. Then send it to the SendGrid
<div class="module preheader preheader-hide" role="module" data-type="preheader">
<div role="module-content" style="display: none!important; mso-hide:
all; visibility: hidden; ">
<p id="preheaderId"> your pre header </p>
</div>
</div>

Meteor: Fetching Data From Account-Twitter Mongo Collection

I'm trying to display some data from the accounts-twitter package. I need the user's profile pic, username, and name, all from Twitter. I've checked using meteor mongo to see that this data is in there. Profile.html is where I store my templates for this:
<template name="profile">
<div class="col s4">
<div class="z-depth-2">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<img class="circle-profile center-align" src="{{services.twitter.profile_image_url}}" style="border-radius: 50%" width="50px" height="50px"/>
<br>
<span class="card-title">{{profile.name}}</span>
</div>
<div class="card-action">
View Profile
</div>
</div>
</div>
</div>
</template>
<template name="display">
{{#each users}}
{{> profile}}
{{/each}}
</template>
I also have profile.js that fetches the data from the collection using a helper:
Template.display.helpers({
users: function() {
return Mongo.users.find();
}
});
When I look at my main area, the profiles I have in the collection aren't showing. Please advise. Thanks in advance!
From the docs
The profile is published by default and only updatable by the current user. The services, where the Twitter information is stored is not because that would be a security issue since it contains the authentication tokens. What would probably work best is in the onCreateUser() method copy those values to the profile so they are published.
You could also publish only those fields you need from the services but I personally like to keep that separate since it contains sensitive information.

post form to an iframe on another form (is it possible)

I'm using ASP.NET web forms and i need to post data to an iframe, the problem is that in web forms I have the main form tag(form1), so i need another form tag(form2), to post data to the iframe that is in the main form1.
Basically i have this:
<form method="post" id="form2" action="http://localhost:58903/WebForm1.aspx" target="webApp">
<input type="hidden" name="ValidationUserName" value="david" />
<input type="hidden" name="ValidationTokenId" value="13123132132" />
<button type="submit">Send info to inner iframe</button>
</form>
<form id="form1" runat="server">
<iframe id="webApp" name="webApp" src="http://localhost:58903/WebForm1.aspx" style="width: 800px; height: 800px;"></iframe>
</form>
With this approach in open a new tab, if i put the iframe outside it works ok, but if i do this the layout is changed and i don't want this.
Is this possible?
If all the forms are in the same domain you should not work with iframes.
What exactly are you trying to get here? didn't realize completely
Done it, it was missing the "name" attribute in the <form> tags.

clicking on a div is not submitting form in Chrome on localhost

I think I have found an interesting problem (at least to me). I have a form that uses a click on a div inside the form to submit. I have used "document.forms.form.submit()" to make the div clickable to submit as suggested here this.form.submit() not working after clicking div element in form (thanks David Hedlund!)
However the form was working fine in chrome, ff. But for some unknown reason, running the form in localhost on chrome is not working now. ff is working fine. What makes the problem interesting is when I uploaded the form to a web-server it works in chrome! Any Idea why this is happening in local machine? I am using Xampp.
Here is the form-
<form name="form" action="login_process.php" method="POST">
<div>
Username: <input style="width:100px;" name="login_client[]" type="text" />
Password: <input style="width:100px;" name="login_client[]" type="password" />
</div>
<div align="right" class="whitearial12" style="position:absolute; font-size:10px; width:360px; height:17px; right:110px; top:35px;">
Forgotten your password, or need to register?
</div>
<!-- this is the div !-->
<div onClick="document.forms.form.submit()" align="center" class="whitearial12" style="cursor: pointer; position:absolute; padding-top:3px; padding-bottom:-3px; width:80px; height:17px; right:20px; top:10px; background-image: url(Images/button_blank.png); background-repeat:no-repeat">
Log In
</div>
</form>
Update: Let me add what I noticed further. This form is included in index.php file from another php file named header.php. I have tried running only the header.php. The form works alright in that case in chrome. But including it in index.php does not work.
I would suggest including jQuery and reworking to resemble this
<form id="MyForm" action="login_process.php" method="post">
<span onclick="javascript:$('#MyForm').submit();">Magical ponies await</span>
</form>
Using jquery can help with cross-browser issues a lot, but if you can't do that, how about
<form id="XX" action="login_process.php" method="post">
<span onclick="javascript:document.getElementById('XX').submit();">AVAST</span>
</form>

several pages Form in jqtouch?

I'm trying to set up a form in jqtouch with several pages. Basically the user will answer couple questions, go to the next page, answer couple more questions and submit. But Jqtouch doesnt work if I set up one form and put the pages inside of the form tags. Any suggestion how can I solve this problem?
I had the same problem. You're probably using a type of master page to do this, try do pages with form tag like you page tag, eg:
<form id="home" class="current">
<div class="toolbar">
<h1>Title</h1>
<a class="back hidden" id="btBack" runat="server">Back</a>
</div>
<ul>
...
</ul>
</form>