Click here to Skip to main content
15,886,919 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: anybody please help in asp.net Pin
AshishChaudha30-Jun-12 8:10
AshishChaudha30-Jun-12 8:10 
QuestionThe namespace attribute cannot have empty string(WebService) Pin
vinayh11-Jun-12 22:59
vinayh11-Jun-12 22:59 
AnswerRe: The namespace attribute cannot have empty string(WebService) Pin
Abhinav S11-Jun-12 23:21
Abhinav S11-Jun-12 23:21 
GeneralRe: The namespace attribute cannot have empty string(WebService) Pin
vinayh12-Jun-12 0:10
vinayh12-Jun-12 0:10 
Questionintermittent issues with visual studio 2010 when calling a web service Pin
zied_jouini11-Jun-12 12:45
zied_jouini11-Jun-12 12:45 
QuestionReaching a button outside an updatepanel. Pin
Mark Vloerjans11-Jun-12 6:38
Mark Vloerjans11-Jun-12 6:38 
AnswerRe: Reaching a button outside an updatepanel. Pin
Sandeep Mewara11-Jun-12 8:50
mveSandeep Mewara11-Jun-12 8:50 
QuestionHow to change the checked attribute of dynamically created html radio button in jquery? Pin
javedhakim11-Jun-12 1:23
javedhakim11-Jun-12 1:23 
Hi! I am trying to change the checked attribute of dynamically created html radio button in asp.net using jquery. I tried different methods but I am not able to change the attribute.

My aspx page is as follows,
ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/FormMaster.master" AutoEventWireup="true"
    CodeFile="ArabiaHRLetterSurveyForm.aspx.cs" Inherits="HRLetter_Arabia_ArabiaHRLetterSurveyForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="latest" style="width: 98%; margin-left: 10px; margin-right: 10px">
        <span class="corner-right">
            <div class="actions">
                <a href="#" class="status" id="lnkHistory" style="color: #fff">History</a></div>
            HR Letter Survey Form </span>
    </div>
    <div style="width: 98%; margin-left: 10px; margin-right: 10px;">
        <div>
            <table cellpadding="0" cellspacing="0" width="100%" class="tableClass">
                <tr class="trClass" align="right">
                    <th class="full" colspan="5">
                        Header
                    </th>
                </tr>
                <tr class="trClass" style="width: 100%">
                    <td class="first" style="width: 20%">
                        Request No
                    </td>
                    <td class="last" style="width: 80%">
                        <a href="#" class="status" id="lnkRequestNo" style="color: Blue" target="_blank">
                            <%=Request["requestid"]%></a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="div_survey" runat="server" style="width: 98%; margin-left: 10px; margin-right: 10px;">
    </div>
    <div>
        <table align="center">
            <tr>
                <td class="innerTd">
                    <a href="#" id="btnSubmit" runat="server" class="button-small" onserverclick="btnSubmit_Click">
                        <span class="corner-right-small">Submit</span></a>
                </td>
            </tr>
        </table>               
    </div>
    <asp:HiddenField ID="hUserIdEncrypted" runat="server" />
    <asp:HiddenField ID="hInitiatorUserId" runat="server" />
    <asp:HiddenField ID="hSurveyId" runat="server" />
    <script type="text/javascript">

        $("#lnkRequestNo").attr("href", "ArabiaHRLetterRequest.aspx?requestid=" + <%=Request["requestid"]%> +"&userId= " +  $("#<%=hUserIdEncrypted.ClientID %>").val()); 
                       
        $("#lnkHistory").fancybox({
            'width': 700,
            'height': 400,
            'autoScale': true,
            'transitionIn': 'none',
            'transitionOut': 'none',
            'type': 'iframe'
        });

        $("#lnkHistory").attr("href", "ArabiaHRLetterSurveyFormHistory.aspx?surveyid=" + $("#<%=hSurveyId.ClientID %>").val());
        
        $("#<%=btnSubmit.ClientID %>").click(function(ev) {
            ev.preventDefault();
            var id;
            var selected;            
            $("#<%=div_survey.ClientID %> tr:not(:has(th))").each(function() {
                $(this).find("td").each(function() {
                    var o = $(this);
                    var firstCol = o.parent().children().first();
                    id = firstCol.text();
                    selected = "N/A";
                    firstCol.next().next().find("input").each(function() {
                        if($(this).is("checked")) {
                            if($(this).val() == "YES")
                                selected = "YES";
                            else if($(this).val() == "NO")
                                selected = "NO";
                            else if($(this).val() == "N/A")
                                selected = "NA";
                        }                        
                    });
                    firstCol.next().next().find("textarea").each(function() {
                        selected = "TextArea";
                    });
                });
                alert(id);
                alert(selected);
            });
        });

        $("input").each(function() {   
            $(this).click(function(ev) {    
                alert($(this).val());
                if($(this).val() == "YES")
                {
                $("input[value='YES']").attr('checked', true);
                $("input[value='NO']").attr('checked', false);
                $("input[value='N/A']").attr('checked', false);
                }
                else if($(this).val() == "NO")
                {
                $("input[value='YES']").attr('checked', false);
                $("input[value='NO']").attr('checked', true);
                $("input[value='N/A']").attr('checked', false);
                }
                else if($(this).val() == "N/A")
                {
                $("input[value='YES']").attr('checked', false);
                $("input[value='NO']").attr('checked', false);
                $("input[value='N/A']").attr('checked', true);
                }
                //$('#Yes').attr("checked",false).checkboxradio("refresh");
                //$("input[type='radio']").attr("checked",true).checkboxradio("refresh");
                //$('input[name="yes_no_na0"]').attr('checked', false);
                //$(this).next().attr('checked', false);
                //$(this).next().next().attr('checked', false);

            }); 
        });

    </script>
</asp:Content>


My code behind file is as follows,

C#
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GWC.ToolKits;

using System.Data.Linq;
using System.Linq;
using System.Text;

using System.Windows;

public partial class HRLetter_Arabia_ArabiaHRLetterSurveyForm : System.Web.UI.Page
{

    protected void Page_PreInit(object sender, EventArgs e)
    {
    }

    protected void Page_Init(object sender, EventArgs e)
    {
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindQuestions();
            hInitiatorUserId.Value = EncryptDecrypt.EncryptDecrypt.GetDecryptedData(Request["userId"]);
            hUserIdEncrypted.Value = Request["userId"];
            var m1 = Database.GetSurveyId(Request["requestId"]);
            hSurveyId.Value = m1.survey_id.ToString();

            var m = Database.GetSurveyId(Request["requestid"]);            
        }
    }

    private void BindQuestions()
    {
        StringBuilder surveytable = new StringBuilder();
        var m = Database.GetQuestions();

        if (m.Count > 0)
        {
            surveytable.Append("<table cellpadding='0' cellspacing='0' width='100%' class='tableClass'>");
            surveytable.Append("<tr class='trClass' align='right'>");
            surveytable.Append("<th class='full'>Id</th><th class='full'>Questions</th><th class='full'>Answers</th>");
            surveytable.Append("</tr>");
            if (m.Count > 0)
            {
                for (int i = 0; i < m.Count; i++)
                {
                    surveytable.Append("<tr class='trClass' style='width:100%'>");
                    surveytable.Append("<td class='first' style='width:5%'>" + m[i].question_id + "</td>");
                    surveytable.Append("<td class='first' style='width:60%'>" + m[i].question_description + " </td>");
                    if (m[i].question_type_id == 1)
                    {
                        surveytable.Append("<td class='last' style='width:35%'>");
                        surveytable.Append("<input id=\"rdoYes" + i + "\" name=\"yes_no_na" + i + "\" value=\"YES\" checked=\"false\" type=\"radio\">YES</input>");
                        surveytable.Append("<input id=\"rdoNo" + i + "\" name=\"yes_no_na" + i + "\" value=\"NO\" checked=\"false\"  type=\"radio\">NO</input>");
                        surveytable.Append("<input id=\"rdoNa" + i + "\" name=\"yes_no_na" + i + "\" value=\"N/A\" checked=\"true\"  type=\"radio\">N/A</input>");
                        surveytable.Append("</td>");
                    }
                    else
                    {
                        surveytable.Append("<td class='last' style='width:35%'>");
                        surveytable.Append("<Textarea id=\"txtComment" + i + "\" type=\"text\" runat=\"server\" style='width:98%; height:100px'></Textarea>");
                        surveytable.Append("</td>");
                    }
                    surveytable.Append("</tr>");
                }
            }
            surveytable.Append("</table>");
            div_survey.InnerHtml = surveytable.ToString();
        }
        else
        {
        }
    }

    private void SendNotificationAll(string userId, string subject, string body, string cc, string bcc)
    {
        try
        {
            string approvalEmail;
            approvalEmail = EmployeeData.GetEmployeeEmailByUserId(userId);
            MailHelper mailHelper = new MailHelper();
            Utilities util = new Utilities();
            mailHelper.SendMailMessage(util.GetValueFromConfigFile("SupportEmail"), approvalEmail, bcc, cc, subject, body);
        }
        catch (Exception exp)
        {
            LogManager logHelper = new LogManager(Request.PhysicalApplicationPath.Trim(), "HR Letter Request");
            logHelper.LogError("[SendApproverNotification - ]" + exp.Message);
        }
    }

    private void AlertMessage(string message)
    {
        string strScript;
        strScript = "<script language=javascript>alert('" + message + "');</script>";
        Page.RegisterClientScriptBlock("key", strScript);
    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DateTime datetime1, datetime2;
        datetime1 = DateTime.Now;
        datetime2 = datetime1.AddSeconds(1);

        string request_no = Request["requestid"];

        var m = Database.GetSurveyId(request_no);
        string survey_id = m.survey_id.ToString();        

        Database.UpdateHRLetterSurveyMasterData(request_no, "2");

        Database.RegisterHRLetterSurveyHistory(survey_id, hInitiatorUserId.Value, datetime1.ToString(), "C", datetime2.ToString(), "Survey Completed");

        string peoplelinkUserId = GeneralData.GetCountryPeoplelink("1");

        Database.RegisterHRLetterHistory(request_no, peoplelinkUserId, datetime1.ToString(), "E", datetime2.ToString(), "Survey Completed");

        string messageid;
        messageid = GeneralData.InsertMessage(request_no, peoplelinkUserId, "Survey Request[" + request_no + "]", "inbox", "0", "0", "HRLetter", DateTime.Now.ToString(), "1").ToString();
        GeneralData.InsertMessageHistory(messageid, "inbox", DateTime.Now.ToString());

        Utilities util = new Utilities();

        SendNotificationAll(peoplelinkUserId, "Survey Request[" + request_no + "]", "<span style=\"font-family: Arial; font-size:12px\">Dear PeopleLink, <br /><br />Survey Request is completed.<br /><br />Click the link below for more details:<a href='http://" + util.GetValueFromConfigFile("ServerIPAll").ToString() + "/ArabiaHRLetterSurveyForm.aspx?requestid=" + request_no + "&surveyid=" + survey_id + "<br /><br />Thank you<br/>", "", "");

        AlertMessage("Survey Request Completed");

        Response.Redirect(Page.ResolveUrl("~/HRLetter\\Arabia\\ArabiaHRLetterSurveyForm.aspx?userid=" + hUserIdEncrypted.Value + "&requestid=" + request_no));

    }
}

AnswerRe: How to change the checked attribute of dynamically created html radio button in jquery? Pin
ashjassi17-Aug-12 3:10
ashjassi17-Aug-12 3:10 
GeneralHow to call java script function after getting result from the server Pin
progahmed10-Jun-12 23:54
progahmed10-Jun-12 23:54 
AnswerRe: How to call java script function after getting result from the server Pin
Sandeep Mewara11-Jun-12 0:01
mveSandeep Mewara11-Jun-12 0:01 
GeneralRe: How to call java script function after getting result from the server Pin
progahmed11-Jun-12 2:00
progahmed11-Jun-12 2:00 
GeneralRe: How to call java script function after getting result from the server Pin
Joshua Omundson11-Jun-12 5:49
Joshua Omundson11-Jun-12 5:49 
QuestionASP.NET Report Viewer Doesn't preview Any Thing Although It work Locally ! Pin
ma.amer10-Jun-12 22:51
ma.amer10-Jun-12 22:51 
GeneralRe: ASP.NET Report Viewer Doesn't preview Any Thing Although It work Locally ! Pin
k.Prathap12-Jun-12 1:34
professionalk.Prathap12-Jun-12 1:34 
Questionasp.net Pin
cdinz10-Jun-12 21:49
cdinz10-Jun-12 21:49 
AnswerRe: asp.net Pin
Richard MacCutchan10-Jun-12 22:13
mveRichard MacCutchan10-Jun-12 22:13 
AnswerRe: asp.net Pin
Rahul Rajat Singh12-Jun-12 2:16
professionalRahul Rajat Singh12-Jun-12 2:16 
Questionweb form with linq to sql Pin
sc steinhayse10-Jun-12 14:03
sc steinhayse10-Jun-12 14:03 
QuestionSearch/filtering generic control using ASP.Net MVC, which feature will help me to pass dynamically entity objects. Pin
RahulAJoshi10-Jun-12 5:53
RahulAJoshi10-Jun-12 5:53 
SuggestionBuilding Virtual Data Warehouse With One Extra Line Of Code Pin
Tonyglen8-Jun-12 6:59
Tonyglen8-Jun-12 6:59 
AnswerRe: Building Virtual Data Warehouse With One Extra Line Of Code Pin
Sandeep Mewara8-Jun-12 8:19
mveSandeep Mewara8-Jun-12 8:19 
GeneralIzenda vs. Crystal ad-hoc reporting tools. Pin
Tonyglen8-Jun-12 6:55
Tonyglen8-Jun-12 6:55 
GeneralRe: Izenda vs. Crystal ad-hoc reporting tools. Pin
R. Giskard Reventlov8-Jun-12 8:57
R. Giskard Reventlov8-Jun-12 8:57 
Questionweb modalanchor Pin
tomorrow_ft8-Jun-12 3:31
tomorrow_ft8-Jun-12 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.