Loading a part of the webpage in qt/qml - qt

I want to load just one part of the webpage(e.g. login button of my webpage) in my personal computer application which is written by Qt(version: 5.12.4) but I couldn't find anything which can help me to do this. I think it should have one solution to load iframe/frame or something like these.
For example, the webpage has following content and I want to load button2 in my application.
<!DOCTYPE html>
<html>
<body>
<button id="button1" type="button" onclick="alert('Hello world1!')" >Click button1</button>
<button id="button2" type="button" onclick="alert('some other hi!')" >Click button2</button>
<button id="button3" type="button" onclick="alert('Hello there!')" >Click button3</button>
</body>
</html>
I can load the whole page easily as follow but the challenge is how to load just a proper component like button with button2 id.
Rectangle {
id: LoginButton
width: 200
height: 50
WebEngineView {
anchors.fill: parent
url: "http://my-url-address.com"
}
}
Any idea?!

Related

bootstrap modal popup button does not have onclick serverside event

my web page has a view result button which is a toggle for bootstrap modal popup.
I am unable to create a onclick event for it as control does not go to server side when I click it, only a popup is displayed. How can I get the onclick event to raise serverside event handler.
As you can see I tried creating OnClick event handler but with no success.
<p class="text-center"><button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal" id="btnshowmodal" onclick="Save_Result" runat="server">View Result</button>
change the 'button' to 'asp:Button` because this is an asp.net control that triggers events on code behind.
<asp:Button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal" id="btnshowmodal" onclick="Save_Result" runat="server" Text="View Result"></asp:Button>
left the other attributes as they are - just set the Text. Will be render not a button but an input, but your job will be done.

How to stop a page refresh in angular 2 within aspx

The pagemethod works, however when I use the webmethod it refreshes the page destroying the reason to use angular 2 in the first place.
How do I prevent the form from refreshing the page?
index.aspx
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManagerMain"
runat="server"
EnablePageMethods="true" >
</asp:ScriptManager>
<my-app>Loading...</my-app>
</form>
</body>
index.aspx.cs
[WebMethod]
public static string getString()
{
return "Test";
}
app.component.html
<div>
<Button (click)="btnSubmit_Click">test</Button>
</div>
app.component.ts
btnSubmit_Click()
{
var test = window['PageMethods'].getString(this.onSucces, this.onError);
}
note:
At this moment I'm trying to use angular 2 with aspx for the company if it works it might become a standaard for small frontend api's and since its quite limited on information I appreciate any help.
You should make button type as button, because by default button type is submit. button with type submit may lead to post back a page.
<div>
<Button type="button" (click)="btnSubmit_Click()">test</Button>
</div>

Button code in ASP.NET

I now see a tutorial that when you click on Input in Design section, it shows this code:
Tutorial COde
But when I do the same, it shows this code:
My COde
what is the problem?
put runat="server" Property In Button
<input id="Button1" type="button" value="button" runat="server" />
you also provide appropriate value to button
Try this..
Html :
<button id="button1" onclick="openWin()">Open "myWindow"</button>
<button id="button2" onclick="Button2_onclik()">Close "myWindow"</button>
Javascript :
var myWindow;
function openWin() {
myWindow = window.open("", "myWindow", "width=400,height=200");
myWindow.document.write("<p>This is 'myWindow'</p>");
}
function Button2_onclik() {
window.close();
}
Demo : Click here
Reference : w3schools

Issue adjusting iframe height when opened as popup using ModalPopupextender

I am using a ModalPopupextender Ajax Control to open aspx page in a modal Popup. aspx page is opened in a iframe as shown in below code.The content which is loaded in iframe is dynamic hence I cannot give a fixed height to iframe. I want that I should be able to adjust the height as per the content every time popup is being opened. I have a function to resize the iframe height and I am using that successfully on my other pages where iframe gets populated in the window itself but not able to adjust the height when iframe is opened in a POPUP. I have already tried window onload, iframe onload events without any success.
<asp:ModalPopupExtender ID="ModalPopupExtender2" BackgroundCssClass="transparentBG"
runat="server" CancelControlID="ButtonCancel" OkControlID="ButtonDone"
TargetControlID="btnAddNew" PopupControlID="DivAddWindow" Drag="true" >
</asp:ModalPopupExtender>
<div class="popup_Buttons" style="display: none">
<input id="ButtonDone" value="Done" type="button" />
<input id="ButtonCancel" value="Cancel" type="button" />
</div>
<div id="DivAddWindow" style="display: none;">
<iframe id="IframeEdit" scrolling="no" src="MasterPage.aspx" width="700px">
</iframe>
</div>
I would really appreciate if somebody can lead me the solution to resolve this.
Try this:
<iframe id="IframeEdit" onload="iframeLoaded()" scrolling="yes" src="MasterPage.aspx" width="700px">
</iframe>
following javascript function would get height from the iframe content.
<script type="text/javascript">
function iframeLoaded() {
var iFrameID = document.getElementById('IframeEdit');
if (iFrameID) {
iFrameID.height = "";
iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px";
}
}
</script>
I checked it in even ModalPopupextender, it works.

asp net jquery popup dialog form in asp:formview

i have following problem, i am using a popup jquery dialog with asp:formview .
the purpose of this popup is for user to enter a hyperlink which is placed then in textbox control in formview
the popup dialog div is located outside a formview just after body tag
<body style="background-color: #FFFFFF; font-family:Lucida Console;">
<div id="dialog-form" title="sdfdfsdf" style="font-size:14px; ">
<form>
<fieldset>
<label for="link">sdfdf</label>
<input type="text" name="sdfsdf" id="link" size="32" />
</fieldset>
</form>
</div>
<form id="form1" runat="server" style="margin-top:50px;" >
<div>
<asp:FormView ID="FormView1"
.......
<InsertItemTemplate>
...
<sometextbox ...../>
<button id="create-user" class="ui-state-default ui-corner-all">Create link</button>
...
</InsertItemTemplate>
After clicking a button a popup window is shown BUT the page starts to refresh immediately
and of course the popup is then hidden.
If I relocate the button outside the formview - the page is not refreshed, but i need it in formview..
Any idea what to do?
add the following attribute to the button:
onclick="javascript: return false;"
this behavior should not come out because it is a button not submit button.
it seems when it is inside the form view a submit action is attached to it, check your jQuery scripts maybe you mistakenly added onclick submit while attaching the dialog.
I found my answer:
clientId must be used:
FTB_API['<%=FormView1.FindControl("AdminCommentTextBox").ClientID%>'].SetHtml(...)

Resources