Urgent - reply fast- Unable 2 find nested user control value

Dec 13 2013 9:20 AM
Dear All

I am not able to find nested user control values in C#. The value is setting by jquery.

given below is the complete scenario :

Master Page D - > Content Page A-> User Control B -> Label C -> Label C value which is setting by jquery and when I want to find this value on content Page A the values always showing default value 91.

Below is the JQuery Code to set value in User Control B: 

function GetSelectedValue(ddlId) {

        var objSelectedImage = document.getElementById("SelectedImage");

        var imageUrl = $(ddlId).context.innerHTML;

        var startIndex = imageUrl.indexOf("src=");
        var endIndex = imageUrl.lastIndexOf('"');

        objSelectedImage.src = $(ddlId).context.innerHTML;
        objSelectedImage.src = imageUrl.substring(startIndex + 5, endIndex);
        
        if (!($('#effect').is(":visible"))) {
            //run the effect
            $("#effect").show('blind', 200);
        }
        else {
            $("#effect").hide('blind', 200);
        }

        $("#lblClientValue").html($(ddlId).attr("id"));
        $("#lblServerValue").html('');
        
        $('#<%=hdnCountryCode.ClientID%>').val($(ddlId).attr("id")); 
        
         var a = $(ddlId).attr("id");
         alert(a);
         $('#<%=lblCountryCode.ClientID%>').val($(ddlId).attr("id"));
         
         alert($('#<%=lblCountryCode.ClientID%>').val());
      }


C# Code For User Control B

public Int32 intCountryCode
    {
        get
        {
            if (lblCountryCode.Text != "")
            {
                return int.Parse(lblCountryCode.Text);
            }
            else
            {
                return 91;
            }
        }
        set
        {
            if (!value.ToString().Equals("91"))
            {
                lblCountryCode.Text = value.ToString();
            }
        }
    }

C # Code For User Control A to access intCountryCode value from User Control A

txtCountryCode.Text = UCtxtCountryCode.intCountryCode.ToString();

Every time i am receiving "91" on User Control A even JQuery  alert($('#<%=lblCountryCode.ClientID%>').val()); shows the selected values.

please suggest solution.

Thanks

Answers (5)