[RESOLVED] hide span tag which is not in ContentTemplate from update panel
hi all,
I am using update panel for particular thing. But I want to hide one tab which is not in content template.
Is there any way? if not then I need to revamp existing code. Please help.
Re: hide span tag which is not in ContentTemplate from update panel
Without better explanation and code sample, i'm afraid it's not possible to help.
Re: hide span tag which is not in ContentTemplate from update panel
ASPX page
Code:
<tr>
<td align="left" style="padding-top: 20px" class="style9">
<div class="feedbackfrmarrowForTable">
</div>
<div class="programristrationformcaption1">
Corporate Name :<span style="color: #ff0000" id="spncorpstar">*</span></div>
</td>
<td align="left" colspan="3" style="padding-top: 20px">
<asp:TextBox ID ="txtcorp_name" runat="server" AutoPostBack="true" ontextchanged="txtcorp_name_TextChanged">
</asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server"
TargetControlID="txtcorp_name"
ServiceMethod="GetCorpName"
CompletionSetCount="10"
ServicePath="~/HPPws.asmx"
MinimumPrefixLength="3"
EnableCaching="true">
</asp:AutoCompleteExtender>
<asp:UpdatePanel runat="server" ID="upcorpname" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtcorp_name" EventName ="TextChanged" />
</Triggers>
<ContentTemplate>
<asp:HiddenField ID="hdnclntType" runat="server" />
<asp:HiddenField ID="hdncorporate_plan_det_id" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr id="trUserType" runat="server">
<td align="left" style="padding-top: 20px; width:196px" >
<div class="feedbackfrmarrowForTable">
</div>
<div class="programristrationformcaption1">
Coupon Number :<span style="color: #ff0000">*</span></div>
</td>
<td align="left" style="padding-top: 20px">
<asp:TextBox ID="txtCouNO" runat="server" CssClass="inputbox_95"
ontextchanged="txtCouNO_TextChanged" AutoPostBack="true"></asp:TextBox><br />
<asp:UpdatePanel runat="server" id="UpdatePanel3" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtCouNO" EventName="TextChanged" />
</Triggers>
<ContentTemplate>
<asp:HiddenField ID="hdnTrimChk" runat="server" ></asp:HiddenField>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td align="left" style="padding-top: 20px;width:196px">
<div class="programristrationformcaption1">
Employee Number :<span style="color: #ff0000">*</span></div>
</td>
<td align="left" style="padding-top: 20px">
<asp:TextBox ID="txtempcode" runat="server" CssClass="inputbox_95"></asp:TextBox>
</td>
</tr>
CS:
Code:
protected void txtcorp_name_TextChanged(object sender, EventArgs e)
{
DataSet dsclnt_type = new DataSet();
dsclnt_type = hpp.gethppclnttype(txtcorp_name.Text.Trim());
string strclnttype = dsclnt_type.Tables[0].Rows[0]["hpp_client_type_code"].ToString();
string strcorporate_plan_det_id = dsclnt_type.Tables[0].Rows[0]["hpp_client_type_code"].ToString();
hdnclntType.Value = strclnttype;
hdncorporate_plan_det_id.Value = dsclnt_type.Tables[0].Rows[0]["hpp_corporate_plan_det_id"].ToString();
if (strclnttype == "CR")
{
txtempcode.Focus();
txtCouNO.Visible = false;
}
}
I want to hide txtbox txtCouNO' if value is getting 'CR'.
is it possible??? I have tried style none also.
Re: hide span tag which is not in ContentTemplate from update panel
hi all,
Please help. any idea???
Re: hide span tag which is not in ContentTemplate from update panel
Hello,
Is the txtcorp_name_TextChanged event handler actually getting called?
Have you set a breakpoint in that code and seen it execute?
Gary
Re: hide span tag which is not in ContentTemplate from update panel
hi Gary,
Yes it is called. Even hidden field is also changed value as per code.
'hdnclntType.Value = strclnttype;'
This is changing because this is in <ContentTemplate>.
because of update panel. Bt is there any way to hide my Tr tag 'trUserType'?
Re: hide span tag which is not in ContentTemplate from update panel
Ah, I see what you are saying...
Try something like this:
Code:
trUserType.Attributes.Add("style","display:none");
Gary
Re: hide span tag which is not in ContentTemplate from update panel
no luck gary... I am unable to call javascript from that.
not even:
Page.RegisterClientScriptBlock("Error", "<script language ='javascript'>alert('hi')</script>");
calling javascript from ajax update panel is my issue.
Any other idea?
Re: hide span tag which is not in ContentTemplate from update panel
To call javascript from Ajax I need to use this.
---
ScriptManager.RegisterStartupScript(upcorpname, upcorpname.GetType(), "Hi", "blockcoupon()", true);
----
Re: [RESOLVED] hide span tag which is not in ContentTemplate from update panel
Hello,
I am glad to hear that you got it working, but I am very confused by what you are doing :)
In Post #6 you said that you wanted to hide the TR, and the code that I provided should have done this for you.
Gary
Re: [RESOLVED] hide span tag which is not in ContentTemplate from update panel
I was unable to call JS, now I can Check following JS function.
---------------------
function coupon_block() {
var spanEvilstar = document.getElementById('<%=spanEvilstar.ClientID %>')
spanEvilstar.style.display = 'none';
trUserType.style.display = 'none';
}
-----------------------
this works fine. This line helps me call JS.
ScriptManager.RegisterStartupScript(upcorpname, upcorpname.GetType(), "Hi", "blockcoupon()", true);