I build asp webform page (vb.net)
My tooltips crashes when I open modal from code behind using below code
Dim sb As New System.Text.StringBuilder()
sb.Append('<script type='text/javascript'>')
sb.Append('$('#SetTime').modal('show');')
sb.Append('</script>')
ScriptManager.RegisterClientScriptBlock(Me, Me.[GetType](), 'SetTimeModalScript', sb.ToString(), False)
If I open the same modal form using button eg.
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#SetTime"> Launch demo modal
</buton>
everything works fine.
To initialize tooltips I use
$(document).ready(function () {
$('[data-tooltip="true"]').tooltip();
});
I try to find solution but I gave up after few hours.
I must use this code to open modal because I open it to display data for specific gridview row.
Edit
Here is part of code where I put data tooltip :
<asp:LinkButton runat="server" CssClass="btn btn-primary btn-xs" CommandArgument='<%#Eval("ID") %>' CommandName="SetTime" data-tooltip="true" title="Ustaw czas rozpoczęcia i zakończenia zlecenia" data-container="body"> <i class="fa fa-clock-o"></i> </asp:LinkButton>
I tried also with data-target="tooltip" instead data-tooltip="true"
Related
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.
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
I'm using wordpress and i add some button on editor
i wants to trigger click on that well its triggering click
but not opening light box
for example that button codes looks like
<td style="position: relative">
<a title="Add New Alert" aria-labelledby="content_admin_alert_voice" onClick="return false;" onMouseDown="return false;" class="mceButton mceButtonEnabled mce_admin_alert" href="javascript:;" id="content_admin_alert" role="button" tabindex="-1">
<img alt="Add New Alert" src="http://www.xyz.com/themes/abc/wp-content/themes/abc/admin/js/../img/icon-alert.png" class="mceIcon"><span id="content_admin_alert_voice" style="display: none;" class="mceVoiceLabel mceIconOnly">
Add New Alert
</span>
</a>
</td>
and i'm clicking on #content_admin_alert but actions not happens like we actually click on that button
I haven't played with TinyMCE in a while, but the onClick and onMouseDown events are returning false, which would essentially cancel any click actions.
The event is simply not firing, what am I missing?
Code for the button:
<input type="button" class="button hide" id="savetext" style="float:right;" value="Hello" runat="server" OnServerClick="savetext_Click"/>
and the code that is generated (ie. when opened in a browser and the source is viewed) is this:
<input onclick="__doPostBack('ctl00$Main$savetext','')" name="ctl00$Main$savetext" type="button" id="savetext" style="float:right;" class="button hide" value="Save to text" />
I've got <pages clientIDMode="Static" /> in web.config but the name and generated onclick event are prefixed despite that.
Server side code:
Protected Sub savetext_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
To be clear, my goal is to register a click on a button server-side, not just client-side. Thanks.
Maybe a javascript error stop it from running...
Well I say that because they only reason that is stop it from working, from the code I see was the javascript error.
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(...)