Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
How can I access html elements in MVC
Blumonde
Nov 21 2017 8:12 PM
188
Reply
Hello,
Below is an example that was done through Asp.net code-behind. Does anyone know how we can accomplish the same task using MVC controller? Here is the link in case you are interested: https://www.mikesdotnetting.com/article/101/persisting-the-position-of-jquery-draggables-in-asp-net
public
partial
class
PersistDraggable : Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
Coordinates coords =
new
Coordinates();
DataTable dt = coords.GetSavedCoords(1);
foreach
(DataRow row
in
dt.Rows)
{
HtmlControl ctl = (HtmlControl)
this
.FindControl(row[
"element"
].ToString());
if
(ctl !=
null
)
{
ctl.Style.Add(
"left"
, row[
"xPos"
].ToString() +
"px"
);
ctl.Style.Add(
"top"
, row[
"yPos"
].ToString() +
"px"
);
}
}
}
}
Thank you for reading this post.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
jQuery-Plugin-For-Automatic-Background-Slideshow-with-Image-
No 'Access-Control-Allow-Origin' header ajax call