Open Popup on Item Template c#.
My problem is that when i click the popup it will open the popup but it will not hit the RowCommand argument(i.e. e.commandname).
Here is the code:
<ItemTemplate><asp:LinkButton ID="imgAppointment" Text="Appointment" runat="server" Style="float: left; margin-right: 5px;" CommandName="App" CommandArgument='<%#Eval("ID") %>' CssClass="label label-sm label-success" data-backdrop="static" data-toggle="modal" data-target="#AddTask"></asp:LinkButton></ItemTemplate>
This is the code on :
protected void gvTaskDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "App")
{
DataTable retval = obj.FetchAppointmentByMalmrktId(Convert.ToInt32(e.CommandArgument));
if (retval.Rows.Count > 0)
{
Repeater rptCustomers = (Repeater)Page.FindControl("rptCustomers");
rptCustomers.DataSource = retval;
rptCustomers.DataBind();
}
}
}
This is the popup div:
<div class="modal fade " id="AddTask" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-right: -15px !important;">
<div class="modal-dialog" style="margin-right: 0; width: 50%; margin-top: 0; margin-bottom: 0px; background: #fff; height: 100vh; overflow-y: auto;">
<div class="modal-header">
<div class="row">
<div class="col-sm-6">
<h3 class="text-primary text-big" style="margin-top: 0px; margin-bottom: 0px;"><b>Appointment </b></h3>
</div>
<div class="col-sm-6">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-chevron-circle-right" id="btnAddTaskclose"></i></button>
</div>
</div>
<asp:Repeater ID="rptCustomers" runat="server">
<HeaderTemplate>
<div class="box-model">
<table class="table">
<tr>
<th style="width: 140px;">Appointment Date :
</th>
</tr>
<tr>
<th style="width: 140px;">Details :
</th>
</tr>
</table>
</div>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width: 400px;">
<asp:Label ID="lbAppointmentdt" runat="server" Text='<%# Eval("Appointmentdate") %>' />
</td>
<td style="width: 400px;">
<asp:Label ID="lblDetails" runat="server" Text='<%# Eval("Details") %>' />
</td>
<td>Status
<br />
<button type="button" class="btn btn-xs btn-danger">Cancel Appointment</button>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
ter>
You can try to trigger the event manually if nothing else works.
If the command event is what you need (if I correctly understand), you can hit the event like this:
<script >
function myModalFunction() {
$("#AddTask").modal();
} </script>
// method to trigger an jsFunction
public void dispararJSfunction(string script)
{
try
{
Page page = HttpContext.Current.CurrentHandler as Page;
ScriptManager.RegisterStartupScript(Page, this.Page.GetType(), "its working", script, true);
}
catch (Exception ex) { Master.MostrarMsn(ex.Message, 0); }
}
protected void imgAppointment_Click(object sender, EventArgs e)
{
// script = the js modal function
dispararJSfunction("myModalFunction()");
CommandEventArgs commandArgs = new CommandEventArgs("Command Name Here", "Your Command Argument Here");
//You can pass any row
//You can also skip the row parameter and get the row from Command Argument
GridViewCommandEventArgs eventArgs = new GridViewCommandEventArgs(GridView1.Rows[0], GridView1, commandArgs);
GridView1_RowCommand(GridView1, eventArgs);
}
If I'm missing something let me know. This is what it came up first to my head. I hope this can help you in some way.
Related
can you tell me whats bad? I need only check on button select language to continue on next website.
HTML
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodySite" runat="server">
<h1>Výběr jazyka:</h1>
<p>Choose language | Sprachauswahl</p>
<form method="post" action="index.aspx">
<div class="checkbox-test">
<table style="border-spacing: 5px; border-collapse: separate;">
<tr>
<td>
<input type="radio" name="check_lang" id="check_cz" class="css-checkbox" value="cz" />
<label for="check_cz" class="css-label"><img src="http://terquil.cz/images/cz.png" class="img-flag" alt="CZ" /></label>
</td>
<td><h2>CZ</h2></td>
</tr>
<tr>
<td>
<input type="radio" name="check_lang" id="check_en" class="css-checkbox" value="en" />
<label for="check_en" class="css-label"><img src="http://terquil.cz/images/uk.png" class="img-flag" alt="EN" /></label>
</td>
<td><h2>EN</h2></td>
</tr>
<tr>
<td>
<input type="radio" name="check_lang" id="check_de" class="css-checkbox" value="de" />
<label for="check_de" class="css-label"><img src="http://terquil.cz/images/de.png" class="img-flag" alt="DE" /></label>
</td>
<td><h2>DE</h2></td>
</tr>
</table>
</div>
<input Type="submit" id="language_btn" VALUE="Pokračovat | Continue | Andere" >
</form>
C# (i tried this but dont work)
protected void submit(object sender, EventArgs e)
{
string cz = "cz";
string de = "de";
string en = "en";
if (Request.Form["check_lang"] != null)
{
string selectLanguage = Request.Form["check_lang"].ToString();
if (selectLanguage == cz)
Response.Redirect("http://terquil.cz/cs/index.aspx");
if (selectLanguage == en)
Response.Redirect("http://terquil.cz/en/index.aspx");
if (selectLanguage == de)
Response.Redirect("http://terquil.cz/cs/index.aspx");
}
}
CSS group objects:
input[type=radio].css-checkbox {
position:absolute;
z-index:-1000;
left:-1000px;
overflow: hidden;
clip: rect(0 0 0 0);
height:1px;
width:1px;
margin:-1px;
padding:0;
border:0;
}
input[type=radio].css-checkbox + label.css-label {
padding-left:37px;
height:32px;
display:inline-block;
line-height:32px;
background-repeat:no-repeat;
background-position: 0 0;
font-size:32px;
vertical-align:middle;
cursor:pointer;
}
input[type=radio].css-checkbox:checked + label.css-label {
background-position: 0 -32px;
}
label.css-label {
background-image:url(http://csscheckbox.com/checkboxes/u/csscheckbox_c1a4f40d98f1c23d1ad84d2af9c314be.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
I need make only that if someone select radio for his specify language and click on submit button so he will redirect to specify html page for his language.
Either use runat="server" to access it in c# code
Or use javascript, on change event of radio button you can store value in a hidden field which will be accessible into your c# code.
$(document).ready(function(){
$('#rdbEnglish').click(function(){
$('#hdn').val('English');
});
when I click on option 1 the data should be visible in next pane and vice versa
Whenever the user clicks on Option1 it should show data to next pane as given in the figure.
so for that what shall be done?
Considering the Options as buttons
asp code
<asp:Button ID="Option1Btn" class="btn" runat="server" OnClick="showDivContent1" />
<asp:Button ID="Option2Btn" class="btn" runat="server" OnClick="showDivContent2" />
<div runat="server" id="option1Content" Visible="false">Some Content </div>
<div runat="server" id="option2Content" Visible="false">Some Content </div>
Backend Code
protected void showDivContent1(object sender, EventArgs e)
{
Option1Btn.Visible = false;
option1Content.Visible = true;
}
Likewise, you can do for the 2nd option as well
protected void showDivContent2(object sender, EventArgs e)
{
Option2Btn.Visible = false;
option2Content.Visible = true;
}
HTML
<div class="left-pan" style="float: left; border-right: 1px solid;">
<div class="Option-1" onclick="Option1Click();">
Option1
</div>
<div class="Option-2" onclick="Option2Click();">
Option2
</div>
</div>
<div class="right-pan">
<div class="showOption1" style="display: none;">
This is Option 1
</div>
<div class="showOption2" style="display: none;">
This is Option 2
</div>
</div>
Javascript :
function Option1Click() {
$(".showOption1").css('display', 'block');
$(".showOption2").css('display', 'none');
}
function Option2Click() {
$(".showOption2").css('display', 'block');
$(".showOption1").css('display', 'none');
}
I am using jquery ui tabs and tooltip and it works perfectly.Heres the code for jquery-ui tabs
$(function() {
$( "#tabs" ).tabs();
$(document).tooltip();
});
I wrote another function which i want to call from code behind on button click event
function setDiv(type){
alert(type);
}
Heres my codebehind function.
protected void btnNext_Click(object sender, EventArgs e)
{
pnlResult.Visible=True;
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "script type='text/javascript' language='javascript'",
"setDiv('highlight')();", true);
}
The problem is when i click the btnNext button ,alert saying highlight is showing.After that i am getting the object expected error on the aspx page and the error points on
<div id="tabs-1">(div used for creating tabs)
Here's my aspx page
<div id="tabs">
<ul>
<li>Nunc tincidunt</li>
<li>Proin dolor</li>
<li>Aenean lacinia</li>
</ul>
<div id="tabs-1">//Here's where i am getting the error
<p>
<asp:Panel ID="pnlResult" runat="server" Visible="false">
<div id="divResult" runat="server">
<span id="spIcon" style="float:left;margin-left:3px;"></span>
Successfully inserted
</div>
</asp:Panel>
<table style="width:50%" id="tbl" runat="server" >
<tr>
<td>
Your Name:
</td>
<td>
<input id="name" title="Enter your name here" />
</td>
</tr>
<tr>
<td >
<span class="ui-icon ui-icon-alert" style="float:left;margin-left:3px;"></span>
<input type="button" id="btnSubmit" value="Submit" />
</td>
</tr>
</table>
</p>
</div>
<div id="tabs-2">
<p>Tab2.</p>
</div>
<div id="tabs-3">
<p>Tab3.</p>
<p>Tab is placed.</p>
</div>
</div>
Your script that you are building in your code behind is malformed, try this:
ScriptManager.RegisterClientScriptBlock(
Page,
typeof(Page),
"setDiv",
"<script type='text/javascript'>setDiv('highlight');</script>",
false);
I have looked at:
The resizable control,
and this forum link,
all without finding the proper resolution.
I have a page (without a master page) that has 2 columns. Once column houses a menu structure, and the other a PDF viewer.
I want to be able to hide the menu, and expand the PDFviewer to the full page.
Unfortunately, I currently only have the Hide() option working.
Here is some code:
Style Sheet.css
body {
}
.wrapper {
margin: 0 auto;
}
.left {
width: 25%;
float: left;
background: #f4f4f4;
overflow: hidden;
}
.right {
width: 75%;
float: right;
margin-top: -20px;
padding-top: -20px;
}
Default.aspx
<div class="wrapper">
<div runat="server" id="left" class="left">
<div style="padding-top: 10px">
<asp:Label runat="server" Text="File List" Font-Size="20px" Font-Bold="True"></asp:Label>
- <a id="uploadLink" href="Upload.aspx">Upload</a>
<br />
<br />
<!-- Menu structure -->
</div>
</div>
<div class="right" id="right">
<a id="showh1">+</a>
<a id="hideh1">-</a>
<div style="border: 1px solid grey;">
<iframe runat="server" id="pdfHolder" width="100%" seamless="seamless" title="Doc"></iframe>
</div>
</div>
<asp:Label runat="server" ID="lbltest" Text=" ---- " Visible="False"></asp:Label>
</div>
Javascript snippet on Default.aspx
<script type="text/javascript">
$(document).ready(function () {
$('#hideh1').click(function () {
$('div.left').hide("Drop");
});
$('#showh1').click(function () {
$('div.left').show("Drop");
});
});
</script>
How can I correctly do this?
Try this:
<script type="text/javascript">
$(document).ready(function () {
$('#hideh1').click(function () {
$('div.left').hide("Drop");
$('div.right').css("width", "100%");
});
$('#showh1').click(function () {
$('div.left').show("Drop");
$('div.right').css("width", "75%");
});
});
</script>
When I click 'Share', then it opens facebook share page in a new tab. I want to show temp.jpg in left bar in this page. How to do this?
test.aspx
<div id="page-wrap">
<!-- AnythingSlider #1 -->
<ul id="slider1" style="width: 778px; height: 452px; background:#fff;">
<li>
<div style="float: left; padding-right: 35px; padding-left:50px;">
<img src="../../img/temp.jpg" style="width: 264px;
height: 377px; border: none;" />
<uc:DownloadControl ID="DownloadControl1" runat="server" PageParameters="1" />
</div>
</li>
<li>
<uc:DownloadControl ID="DownloadControl2" runat="server" PageParameters="2" />
...
DownloadControl.ascx
<div style="float: left">
<a class="icerik" id="facebookShare" runat="server" target="_blank">
<img border="0" src="images/facebook.jpg" alt="Resorts"
title="Hotels & Resortss" /> Share </a>
DownloadControl.ascx.cs
protected void Page_Load(object sender, EventArgs e)
{
facebookShare.HRef = "http://www.facebook.com/sharer.php?u=http://www.test.com/test.aspx";
}
You have to make FRAMES http://www.w3schools.com/tags/tag_frame.asp and change your link's target="_blank" to target="framename"