WatiN read attribute from iframe's body - c#

Is there a way to read the style attribute of body inside an iFrame?
I've tried using multiple combinations of Body, NativeElement, Frame and other Properties, but so far I had no luck.
<iframe id="iFrame" width="100%" height="500" frameborder="0" src="some source">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body style="margin: 0px; padding: 0px;height:500px;">
</body>
</html>
</iframe>
Example:
_browser.Frame(Find.ById(frameId)).Body.GetAttributeValue("style")

Iframe may be inside a different form, did you tried?
it happend once to me, the iframe was in a different form(nested form)

Related

Blazor - Writing text to background

I am trying to write text to the background of a blazor application.
I want it to show all my method calls in the background (so it looks techy!)
Does anyone know the best way to do this? I have researched but found nothing as of yet.
On the HTML/CSS side, it should be something along these lines:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
#content{
position: absolute;
top: 0%;
left: 0%;
font-size: 50px;
color: black;
-ms-transform: translate(-50%,-50%);
}
#background{
color: darkgray;
}
</style>
</head>
<body>
<div id="background">
This is my<br/>
background<br/>
content ...<br />
</div>
<div id="content">
This is my overlay content.
</div>
</body>
</html>
Two content blocks are created with the div tags: one for the foreground and one for the background. JavaScript can then be used to animate/adjust the background content accordingly to get your required effect.

unable to get css when sending email with css

is there any way you can send an email from c# asp.net with a html page with css.
Currently I am sending the email but when I open in gmail it does not capture the css included in the htmlpage
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
body{
background-color:navy;
color:white;
font-family:Menulis;
margin-left:40px;
}
div {
margin:0 auto;
}
img{
border-radius:5px;
width:200px;
height:300px;
margin-right:200px;
display:block;
float:right;
}
</style>
</head>
<body>
<div>
<h1>User {user_email} Error Report</h1>
<p>The following error occured when user is trying to reset password
from pswrd_recover.aspx page:</p><br/>
<img src="https://pcappliancerepair.files.wordpress.com/2016/11
/38644550_m.jpg?w=585"/>
<p>{error_message}</p>
</div>
</body>
</html>
Gmail removes the entire head portion of your email’s HTML. So, it will also remove any style elements.
You need to inline your CSS, like this:
<body style="background-color:navy; color:white;font-family:Menulis;margin-left:40px;">
<div style="margin:0 auto;">...</div>
<img style="border-radius:5px;width:200px;height:300px;margin-right:200px;display:block;float:right;" src="https://..." />
</body>

having an asp back button in popup window for displaying pdf

Am having a popup window for displaying pdf.. but i need to put an asp button in pop up window have tried the following code but could not find a solution.. can any one resolve this?
enter code here
<asp Page attributes>
...............
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<br />
<form id="form1" runat="server">
<div> <asp:Button ID="dd" runat="server" OnClick="Backonclick" Text="back"/>
</div>
<div></div>
</form>
</body>
</html>
on page load event
dd.Visible = true;
string path = Request.QueryString["val"].ToString();
string extention = Path.GetExtension(path);
int len = extention.Length - 1;
string extwithoutdot = extention.Substring(1, len);
if (extwithoutdot.Equals("JPG") || extwithoutdot.Equals("jpg") ||
extwithoutdot.Equals("jpeg") || extwithoutdot.Equals("JPEG"))
{
extwithoutdot = "jpeg";
...........
The issue here is that you're mixing two separate types of documents; a PDF is one type of download, whilst an HTML is another. A single download can't unfortunately be both, and you can't switch document types part-way through and expect the browser to handle it.
The simplest solution for what you're after is to combine the two on the client side. Load your pop-up as an HTML page (generated by ASP.NET if you wish) and include within that an IFRAME linking to your PDF generation script; something of the form:
<html>
<body>
<a class='button' href="javascript:window.close()">Close</a>
<iframe src="generatePdf.aspx" height="300" width="300" />
</body>
</html>
i have got solution
<form id="form1" runat="server">
<iframe src="Copy (2) of DisplayPdf.aspx" width="1000" height="400">
</iframe>
<iframe src="Copy of DisplayPdf.aspx" width="100" height="200">
</iframe>
</form>

DateTimepicker in Asp.net

I want to show date and time picker. I googled many times but not getting anything. I download the files from the "keduoi.com" and used in mu project but its not working properly showing only textfield. I am trying from this link.
Here is code:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="LaterTime_Pick_up.aspx.cs" Inherits="LocationBasedTaxiServices.LaterTime_Pick_up" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="styles/kendo.common.min.css" rel="stylesheet" />
<link href="styles/kendo.default.min.css" rel="stylesheet" />
<script type="" src="js/jquery.min.js"></script>
</head>
<body>
<div id="example" class="k-content">
<div id="to-do">
<input id="datetimepicker" style="width:200px;" />
</div>
<script type="">
$(document).ready(function () {
// create DateTimePicker from input HTML element
$("#datetimepicker").kendoDateTimePicker({
value: new Date()
});
});
</script>
<style scoped>
#to-do {
height: 52px;
width: 221px;
margin: 30px auto;
padding: 91px 0 0 188px;
background: url('../../content/web/datepicker/todo.png') transparent no-repeat 0 0;
}
</style>
</div>
</body>
</html>
It's showing only textfield.
I am not sure unless you can tell exactly what error you are getting. But if you have not added js file then go ahead and do it first.
There are different plans available to get kendo ui. Refer This
There is documentation by kendo for using datepicker in asp.net application.
Link Here
You must include the Javascript for kendoui.
<script src='xxxx/kendo-uixxx.js'></script>
kendo.all.min.js is missing in your code.
You also can use jQuery.UI, it sometimes easier for beginners to start building client interfaces with jQuery.
jQuery UI: http://jqueryui.com/
jQuery UI Datepicker: http://jqueryui.com/datepicker/

Replace size parameter in css

I want to replace all font-size-parameters in a html document (css attributes).
I'm using .net with c#.
I guess it could be done with some regular expression.
Am I forgetting some other ways to set the font size?
Example:
<html>
<head>
<style type="text/css">
.t {
font-size: large;
}
</style>
</head>
<body>
<span style="font-size: medium" />
</body>
</html>
into:
<html>
<head>
<style type="text/css">
.t {
font-size: large_replaced;
}
</style>
</head>
<body>
<span style="font-size: medium_replaced" />
</body>
</html>
if you use relative unit like em, ex etc for all font dimensions in your page. By adjusting
only html elements' size you manage all fonts
big fonts
html{
font-size:18px;
}
smaller fonts
html{
font-size:18px;
}
you can manage that form javascript, better (also using cookies).
I ended up using the following regex to find where to replace:
/style=\"[.]*font-size:(?<size>[^;]*);[^\"]*[\"]/
/<style[^<]*font-size:(?<size>[^;]*);[^<]*[<]/

Categories

Resources