hi
I use java code to hide and show Div when users select Item from DropDownList
Here when a page is running (As default) it shows Divsell and hides DivRent
$('#DivRent').hide();
$('#DivSell').show();
When users select Rent Item from DropDownList it will show DivRent and Hides DivSell
case "Rent": $('#DivSell').hide(); $('#DivRent').show();
Until now everything works correctly but when I click the Imagesend button it returns everything as default I mean it shows Divsell and hides DivRent
$('#DivRent').hide(); $('#DivSell').show();
But I want when I select Rent item from the dropdown list and click a button it does:
case "Rent": $('#DivSell').hide(); $('#DivRent').show();
Below are codes:
<script type="text/javascript">
$(function () {
$(".dropdown-menu li a[id*=Rpttran]").click(function () {
$(this).closest('.dropdown').find(".btn:first-child").text($(this).text().trim());
$(this).closest('.dropdown').find(".btn:first-child").val($(this).text().trim());
$("[id*=hfSelectedTransfer]").val($(this).text().trim());
});
if ($("[id*=hfSelectedTransfer]").val() != "") {
$(".dropdown-menu li a[id*=Rpttran]").closest('.dropdown').find(".btn:first-child").text($("[id*=hfSelectedTransfer]").val());
$(".dropdown-menu li a[id*=Rpttran]").closest('.dropdown').find(".btn:first-child").val($("[id*=hfSelectedTransfer]").val());
}
$('#DivRent').hide();
$('#DivSell').show();
$('.dropdown-menu li a[id*=Rpttran]').click(function () {
$('#TH5L1LPM2').hide();
$('#TH5L1LPM11').show();
var Rpttran = $.trim($(this).html());
switch (Rpttran) {
case "Sell":
$('#DivSell').show();
$('#DivRent').hide();
break;
case "Rent":
$('#DivSell').hide();
$('#DivRent').show();
break;
default:
$('#DivRent').hide();
$('#DivSell').show();
}
});
});
</script>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<asp:Repeater ID="Rpttran" runat="server">
<itemtemplate>
<li><a target="_blank" class="dropdown-item" ID="btnsystem" runat="server" CommandArgument='<%# Eval("Transfer") %>'> <%# Eval("Transfer") %></a></li>
</itemtemplate>
</asp:Repeater>
</div>
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
<contenttemplate>
<div id="Div1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" CssClass="txtvadi2" ForeColor="#443f13" onblur="WaterMark(this, event,'تا');" onfocus="WaterMark(this, event,'تا');" Text="تا" onpaste="return false;"></asp:TextBox>
</div>
</contenttemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<contenttemplate>
<div id="Div2" runat="server">
<asp:TextBox ID="TextBox2" runat="server" CssClass="txtvadi2" ForeColor="#443f13" onblur="WaterMark(this, event,'تا');" onfocus="WaterMark(this, event,'تا');" Text="تا" onpaste="return false;"></asp:TextBox>
</div>
</contenttemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-6">
<div id="TH5L1LPM2B" runat="server">
<asp:ImageButton ID="ImageSend" runat="server" CssClass="imgviewMM" ImageUrl="~/Image/main/enter.png" OnClick="ImgviewM_Click" CausesValidation="false"></asp:ImageButton>
</div>
</div>
</div>
Best Regards
Neda