0

I am trying to update the text area displayed in the Ajax modal popup. I am updating the Text area with sharepoint list multiline text field. My spservices is wriiting the data correctly. But when i try to appened the Text area it is unable to show the same.

I am trying to append the data on button click.

here is my code

<script type="text/javascript" language="javascript">

    function GetListData() 
    {
        var method = "GetListItems";
        var list = "WOGDates";
        var fieldsToRead = "<ViewFields>" +
                                "<FieldRef Name='Title' />" +
                                "<FieldRef Name='WOGLicense' />" +
                            "</ViewFields>";

        var query = "<Query>" +
                        "<Where>" +
                            "<Neq>" +
                                "<FieldRef Name='ID'/><Value Type='Number'>0</Value>" +
                            "</Neq>" +
                        "</Where>" +
                        "<OrderBy>" +
                            "<FieldRef Name='Title'/>" +
                        "</OrderBy>" +
                    "</Query>";
        $().SPServices({
            operation: method,
            async: false,
            listName: list,
            CAMLViewFields: fieldsToRead,
            CAMLQuery: query,
            //this basically means "do the following code when the call is complete"
            completefunc: function (xData, Status) {
                $(xData.responseXML).SPFilterNode("z:row").each(function () {
                    var name = ($(this).attr("ows_Title"));
                    var WOGLicensetext = $($(this).attr("ows_WOGLicense")).text();
                    AppenedData(name, WOGLicensetext);
                });
            }
        });
        function AppenedData(name, WOGLicensetext) 
        {

            $("textarea#idTxtArGenHtml").append(result.WOGLicensetext);

        }

    }


</script>






<div>
    <asp:Label ID="lbl_noact" runat="server" Visible="False" Width="282px" CssClass="style4"></asp:Label>
    <asp:GridView runat="server" ID="gvdetails" DataKeyNames="EventID" AutoGenerateColumns="false" Width="502px">
        <RowStyle BackColor="#EFF3FB" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="EventDate" HeaderText="Start Time" ItemStyle-CssClass="col" />
            <asp:BoundField DataField="EndDate" HeaderText="End Time" ItemStyle-CssClass="col" />
            <asp:TemplateField HeaderText=" ">
                <ItemTemplate>
                    <asp:HiddenField ID="EventID_HiddenField" runat="server" Value='<%# Eval("EventID")%>' />
                    <asp:Button ID="ButtonAdd" runat="server" Text="Sign Up" Width="80" Height="25" OnClick="SignUp_Click" OnClientClick="GetListData()"/>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlpopup" BackgroundCssClass="modalBackground" Drag="true" DropShadow="true">
    </ajaxToolkit:ModalPopupExtender>


 <asp:Panel ID="pnlpopup" runat="server"  BackColor="LightGray" Height="500px" Width="800px" Style="display: none">
        <table style="width: 100%; height: 100%;">         
            <tr>
                <td align="center" 
                    style="background-color: #79A2E2; width: 350px; height: 80%;">
                    <samp>
                        <b style="color: #000000; font-size:11pt; font-style: normal; font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                            just a test
                            <br />                            
                            this date has to be finished
                            <br />
                           santosh </b>
                    </samp>
                    <br />
                    <br />

                    <span><textarea  name="nTxtArGenHtml" id="idTxtArGenHtml" width='100%' cols="8" rows="8"></textarea></span>
                    <%--<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Wrap="True" Width="80%" Height="300px">
                    </asp:TextBox>--%>
                    <br />
                    <br />
                    <asp:HiddenField ID="PnlPopup_Hiddenfeild" runat="server" />
                    <asp:Button ID="Agree" runat="server" Text="I have read and agree to the above terms"
                        CommandName="SignUp" OnClick="btnAgree_Click" />&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="Cancel" runat="server" Text="Cancel I Do Not Agree" />
                </td>
            </tr>

        </table>
    </asp:Panel> 
1

You are passing two strings (name and WOGLicensetext) to your AppendData function, yet in the function you are trying to access a result object, which probably doesn't exist in that scope.

So you should change

$("textarea#idTxtArGenHtml").append(result.WOGLicensetext);

to

$("textarea#idTxtArGenHtml").append(WOGLicensetext);
0

You should use

$("textarea#idTxtArGenHtml").html(result.WOGLicensetext);

or

$("textarea#ExampleMessage").val(result.exampleMessage)

depend on if you want to display it as html tags or plain text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.