Click here to Skip to main content
15,991,888 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Hi All,

I have a multiline textbox which has formatting toolbar loaded from javascript code on page_load.The requirement is to populate the textbox with a default value once a dropdownlist(which is out of datalist) has particular selected item.

I am trying to bind the datalist with the default text in Postback.

    .aspx
<asp:DataList RepeatDirection="Vertical" ID="DataListExeSummary" runat="server"  OnItemDataBound="DataListExeSummary_Databound" OnEditCommand="Edit_Command" >
                                <ItemTemplate>
                                    <table  runat="server" width="100%" id="TableExec">
                                        <tr>
                                            <td>
                                                <asp:UpdatePanel ID="UpdatepanelExe" runat="server">
                                                    <ContentTemplate>
                                                        <asp:Label ID="DataListLabelExeSummary" Text='<%# BIND("FIELD_NAME" ) %>' runat="server"
                                                            SkinID="txt_LabelProjectScreen"></asp:Label>
                                                        <asp:Label ID="DataListLabelExeSummaryReq" Text="*" runat="server" Visible="false"
                                                            SkinID="MandatoryTextRed"></asp:Label>
                                                    </ContentTemplate>
                                                    <Triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="ddlProjectStatus" EventName="SelectedIndexChanged" />
                                                        <%--Added by Kverma for Q3 Enhancement--%>
                                                        <%--<asp:AsyncPostBackTrigger ControlID="ddlSubType" EventName="SelectedIndexChanged" />----%>
                                                    </Triggers>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <%--<asp:UpdatePanel ID="UpdatePanelProjectExpense" runat="server">
                                                    <ContentTemplate>--%>                                                        
                                                      <asp:TextBox id="textExecutiveSummary" TextMode="multiline" runat="server" Text= '<%# BIND("FIELD_VALUE" )%>'/>
                                                       
                                                        <asp:HiddenField ID="HiddenFieldManageControlsId" Value='<%# BIND("MANAGE_CONTROLS_ID" ) %>'
                                                            runat="server" /> 
                                                        <asp:HiddenField ID="HiddenFieldKey" Value='<%# BIND("FIELD_KEY" ) %>' runat="server" />
                                                        <asp:RequiredFieldValidator ID="rfvCustomEditorExecutiveSummary" runat="server" ControlToValidate="textExecutiveSummary"
                                                            ValidationGroup="ValidatePage" Display="None" ErrorMessage="Validate"></asp:RequiredFieldValidator>                                                       
                                                            
                                                          <asp:LinkButton ID="EditLinkButton" runat="server" Text="Edit" CommandName="Edit" Visible="false"></asp:LinkButton>                                                            
                                                            
                                                    <%--</ContentTemplate>
                                                    
                                                    <Triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="ddlSubType" EventName="SelectedIndexChanged" />
                                                    </Triggers>
                                                </asp:UpdatePanel> --%>      
.cs page

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
                    if (!IsPostBack)
                    {
                        LoadExecutiveSummaryTable();//To load datalist
                                               }
                    }
                    else
                    {
                        if (Request.Form["__EVENTTARGET"] == ddlSubType.UniqueID)
                        {
                        string selected = ddlSubType.SelectedItem.Text.ToString();
                        if (selected == "Licensing")
                        {
                            if (ddlSubType.SelectedItem.Text == "Licensing")
                            {
                                DataListExeSummary.DataSource = null;
                                DataListExeSummary.DataBind();
                                DataSet dsExec = (DataSet)Session[UIConstants.EXECUTIVESUMMARY];
                                for (int i = 0; i < dsExec.Tables[0].Rows.Count; i++)
                                {
                                    dsExec.Tables[0].Rows[i]["FIELD_VALUE"] = "<P  style= \"MARGIN: 0in 0in 0pt\">See Report</P>";
                                }
                                dsExec.AcceptChanges();
                                Session[UIConstants.EXECUTIVESUMMARY] = dsExec;
                                DataListExeSummary.DataSource = dsExec;
                                DataListExeSummary.DataBind();

                            }
                          }

                        }
                }
        }
        catch (Exception ex)
        {
            if (ExceptionManager.HandleException(ex, CommonConstants.POLICY_NAME))
            {
                UIHelper.RedirectToErrorPage();
                throw ex;
            }
        }
    }


If I uncomment the UpdatePanel stuuf in aspx the textbox is being populated with default text but the toolbar is not being bount to textbox.it populated as normal textbox.

Thanks
Pallavi
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900