Results 1 to 11 of 11

Thread: [RESOLVED] hide span tag which is not in ContentTemplate from update panel

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    Resolved [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.
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    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.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    Resolved 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.
    Last edited by sagarpassion; Feb 1st, 2013 at 03:50 AM.
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    Re: hide span tag which is not in ContentTemplate from update panel

    hi all,

    Please help. any idea???
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  5. #5
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    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'?
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  7. #7
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    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?
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    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);
    ----
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  10. #10
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    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);
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width