Rectangle 27 1

Try this code. I have used this piece of code in my website and it is working fine. On button click event, I am able to get the date value entered in the textbox using .text property of textbox.

<asp:TextBox ID="txtDateFrom" runat="server" Width="70px"></asp:TextBox>
<ajax:CalendarExtender ID="CalendarExtender1" runat="server" CssClass="MyCalendar" Format="MM/dd/yyyy" TargetControlID="txtDateFrom" Enabled="True"></ajax:CalendarExtender>

<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" AcceptNegative="Left" DisplayMoney="Left" ErrorTooltipEnabled="True" InputDirection="RightToLeft" Mask="99/99/9999" MaskType="Date" TargetControlID="txtTranDateFrom" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"></ajax:MaskedEditExtender>

.text property of textbox always gives null value (as mention in question). Give supportive links

Because my textbox was in readonly mode (readonly=true) the values were not being fetched

asp.net - Get selected date of ajax calendar extender control - Stack ...

asp.net ajax asp.net-ajax ajaxcontroltoolkit
Rectangle 27 1

if your Multiline textbox is not working then put your buttons from outside of Update panel. its work perfectly for me. i just put my asp buttons outside of update panel. here is code sample when my multiline textbox text not working.

<td style="float: center; padding-left: 155px;">
                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                            <ContentTemplate>
                                                <asp:Button ID="btnPre" OnClientClick="Validate();" ValidationGroup="group1" runat="server"
                                                    CssClass="alt_btn" Text="Preview Your Email" OnClick="btnPre_Click" TabIndex="8" />
                                                <asp:Button ID="Continue" OnClientClick="Validate();" ValidationGroup="group1" runat="server"
                                                    CssClass="alt_btn" Text="Continue" OnClick="Continue_Click" TabIndex="8" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>

and when i put my button from out side of update panel then multiline textbox text updating perfectly.

<td style="float: center; padding-left: 155px;">
                                                <asp:Button ID="btnPre" OnClientClick="Validate();" ValidationGroup="group1" runat="server"
                                                    CssClass="alt_btn" Text="Preview Your Email" OnClick="btnPre_Click" TabIndex="8" />
                                                <asp:Button ID="Continue" OnClientClick="Validate();" ValidationGroup="group1" runat="server"
                                                    CssClass="alt_btn" Text="Continue" OnClick="Continue_Click" TabIndex="8" />
                                    </td>

hmm. but our requirement works perfectly.

c# - Enable Multiline Textbox to sumbit the form on Enter Key in asp.n...

c# jquery asp.net webforms
Rectangle 27 6

The RequiredFieldValidator is triggered by the client side onchange event. It sounds like you're expecting it to be triggered by the onblur event, such that tabbing away from the textbox would fire the validation.

Before jumping to that, I suspect this is what you are seeing and to validate that it's actually working you need to trigger onchange. To do so, enter some text in the textbox, tab away, tab back to it, clear the textbox, then tab away once more. You should now see the RequiredFieldValidator's error message since it's contents have changed.

Back to the onblur issue. To accomplish that behavior you could add the onblur attribute in your code-behind and have it call the ValidatorValidate(...) JavaScript method as follows:

void Page_Load(object sender, EventArgs e)
{
    txtSummary.Attributes.Add("onblur", "ValidatorValidate(" + reqvalSummary.ClientID + ")");
}

Alternately, you could accomplish the same thing in markup. First, add this script block:

<script type="text/javascript">
    function rfvBlur() {
        var rfv = document.getElementById("<%= reqvalSummary.ClientID %>");
        ValidatorValidate(rfv);
    }    
</script>

Second, update the <asp:TextBox.../> markup by adding onblur="rfvBlur()" so that it now looks like this:

<asp:TextBox ID="txtSummary" runat="server" TextMode="MultiLine" Width="700px" CausesValidation="true"
            CssClass="txtStyle" Font-Names="Arial" MaxLength="1000" ValidationGroup="Valtxt"
            TabIndex="2" Rows="4" onblur="rfvBlur()" />

Yet another option is to validate the entire ValidationGroup by adding the following attribute to your <asp:TextBox.../> markup (no additional script block needed):

onblur="Page_ClientValidate('Valtxt')"

Jerry Scannell's comment: "I'm trying to incorporate the rfvBlur() recommended but I can't figure out what ClientID was referencing in your example."

@PeterO. thanks for posting Jerry's comment. @Jerry: the ClientID is being called off of a asp:RequiredFieldValidator with an ID of reqvalSummary. You can see this validator in the original question, which is validating the txtSummary TextBox control. Use whatever ID you've given to your RequiredFieldValidator control. You'll need to do this for each control/validator you intend this to work with.

asp.net - Required field validator not working - Stack Overflow

asp.net validation requiredfieldvalidator
Rectangle 27 1

I was facing the same issue as I needed to set focus on the textbox after postbacks in update panel. So I researched over internet & found this Javascript code. I tried it & it is working perfectly. It adds event listener for update panel for before & after postback. Gets textbox id before postback & set it after completion of postback.

var lastFocusedControlId = "";

    function focusHandler(e) {
        document.activeElement = e.originalTarget;
    }

    function appInit() {
        if (typeof (window.addEventListener) !== "undefined") {
            window.addEventListener("focus", focusHandler, true);
        }
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler);
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler);
    }

    function pageLoadingHandler(sender, args) {
        lastFocusedControlId = typeof (document.activeElement) === "undefined"
            ? "" : document.activeElement.id;
    }

    function focusControl(targetControl) {
        if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
            var focusTarget = targetControl;
            if (focusTarget && (typeof (focusTarget.contentEditable) !== "undefined")) {
                oldContentEditableSetting = focusTarget.contentEditable;
                focusTarget.contentEditable = false;
            }
            else {
                focusTarget = null;
            }
            targetControl.focus();
            if (focusTarget) {
                focusTarget.contentEditable = oldContentEditableSetting;
            }
        }
        else {
            targetControl.focus();
        }
    }

    function pageLoadedHandler(sender, args) {
        if (typeof (lastFocusedControlId) !== "undefined" && lastFocusedControlId != "") {
            var newFocused = $get(lastFocusedControlId);
            if (newFocused) {
                focusControl(newFocused);
            }
        }
    }

    Sys.Application.add_init(appInit);

c# - Asp.NET: How to keep focus on textbox in a nested Update Panel - ...

c# javascript asp.net ajax updatepanel
Rectangle 27 2

Don't know why validateRequest="false" is not working. Error Reason: Because you are getting data from a web page which contains Html tags and textbox text property does not allow to assign html strings to it, so you have to use a method which converts html tags to their equivalent code. Use HTML.Encode Method while assigning responseString to the textboxError.Text. This method converts potentially unsafe characters to their HTML-encoded equivalent.

textboxError.Text = Server.HTMLEncode(responseString);

thanks for your nice answer. but after i used textboxError.Text = Server.HTMLEncode(responseString); i got error codes like this ResponsesResponse0ActionsendMessage&lt;/ActionDataAcceptReportStatusCode0/StatusCodeStatusText&gt;Message accepted for delivery/StatusTextMessageID03a22ae5-e604-4fb6-9670-336294905a9d/MessageID&lt;Recipient+85593840396 i used HTML.Encode only on textboxError.Text = Server.HTMLEncode(responseString);

String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty);

also you can use asp:literal control instead of text like this <asp:Literal ID="lit" runat="server" Mode="PassThrough" ></asp:Literal> Then you dont have to use Html.Encode method or rejex to remove html. read more about it on msdn

i used String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty); to remove html tage after i got this error: sendMessage0Message accepted for delivery75d9c6f1-515f-43f6-9b7b-5c2482ce95e8+85568922903. what is problem?

c# - A potentially dangerous Request.Form value was detected from the ...

c# asp.net
Rectangle 27 2

Don't know why validateRequest="false" is not working. Error Reason: Because you are getting data from a web page which contains Html tags and textbox text property does not allow to assign html strings to it, so you have to use a method which converts html tags to their equivalent code. Use HTML.Encode Method while assigning responseString to the textboxError.Text. This method converts potentially unsafe characters to their HTML-encoded equivalent.

textboxError.Text = Server.HTMLEncode(responseString);

thanks for your nice answer. but after i used textboxError.Text = Server.HTMLEncode(responseString); i got error codes like this ResponsesResponse0ActionsendMessage&lt;/ActionDataAcceptReportStatusCode0/StatusCodeStatusText&gt;Message accepted for delivery/StatusTextMessageID03a22ae5-e604-4fb6-9670-336294905a9d/MessageID&lt;Recipient+85593840396 i used HTML.Encode only on textboxError.Text = Server.HTMLEncode(responseString);

String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty);

also you can use asp:literal control instead of text like this <asp:Literal ID="lit" runat="server" Mode="PassThrough" ></asp:Literal> Then you dont have to use Html.Encode method or rejex to remove html. read more about it on msdn

i used String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty); to remove html tage after i got this error: sendMessage0Message accepted for delivery75d9c6f1-515f-43f6-9b7b-5c2482ce95e8+85568922903. what is problem?

c# - A potentially dangerous Request.Form value was detected from the ...

c# asp.net
Rectangle 27 2

Don't know why validateRequest="false" is not working. Error Reason: Because you are getting data from a web page which contains Html tags and textbox text property does not allow to assign html strings to it, so you have to use a method which converts html tags to their equivalent code. Use HTML.Encode Method while assigning responseString to the textboxError.Text. This method converts potentially unsafe characters to their HTML-encoded equivalent.

textboxError.Text = Server.HTMLEncode(responseString);

thanks for your nice answer. but after i used textboxError.Text = Server.HTMLEncode(responseString); i got error codes like this ResponsesResponse0ActionsendMessage&lt;/ActionDataAcceptReportStatusCode0/StatusCodeStatusText&gt;Message accepted for delivery/StatusTextMessageID03a22ae5-e604-4fb6-9670-336294905a9d/MessageID&lt;Recipient+85593840396 i used HTML.Encode only on textboxError.Text = Server.HTMLEncode(responseString);

String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty);

also you can use asp:literal control instead of text like this <asp:Literal ID="lit" runat="server" Mode="PassThrough" ></asp:Literal> Then you dont have to use Html.Encode method or rejex to remove html. read more about it on msdn

i used String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty); to remove html tage after i got this error: sendMessage0Message accepted for delivery75d9c6f1-515f-43f6-9b7b-5c2482ce95e8+85568922903. what is problem?

c# - A potentially dangerous Request.Form value was detected from the ...

c# asp.net
Rectangle 27 2

Don't know why validateRequest="false" is not working. Error Reason: Because you are getting data from a web page which contains Html tags and textbox text property does not allow to assign html strings to it, so you have to use a method which converts html tags to their equivalent code. Use HTML.Encode Method while assigning responseString to the textboxError.Text. This method converts potentially unsafe characters to their HTML-encoded equivalent.

textboxError.Text = Server.HTMLEncode(responseString);

thanks for your nice answer. but after i used textboxError.Text = Server.HTMLEncode(responseString); i got error codes like this ResponsesResponse0ActionsendMessage&lt;/ActionDataAcceptReportStatusCode0/StatusCodeStatusText&gt;Message accepted for delivery/StatusTextMessageID03a22ae5-e604-4fb6-9670-336294905a9d/MessageID&lt;Recipient+85593840396 i used HTML.Encode only on textboxError.Text = Server.HTMLEncode(responseString);

String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty);

also you can use asp:literal control instead of text like this <asp:Literal ID="lit" runat="server" Mode="PassThrough" ></asp:Literal> Then you dont have to use Html.Encode method or rejex to remove html. read more about it on msdn

i used String result = Regex.Replace(responseString, @"<[^>]*>", String.Empty); to remove html tage after i got this error: sendMessage0Message accepted for delivery75d9c6f1-515f-43f6-9b7b-5c2482ce95e8+85568922903. what is problem?

c# - A potentially dangerous Request.Form value was detected from the ...

c# asp.net
Rectangle 27 2

your script is working very well the problem might be in jquery file its not found in the given location you can change the src for check

<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

javascript - KeyPress Event of TextBox in ASP.NET - Stack Overflow

javascript c# jquery asp.net webforms
Rectangle 27 1

You can't access UI Elements from another thread than the one that created it (the UI thread). Your alternatives would be to use a callback, raise an event that your UI thread is subscribed to or use the Dispatcher if you're working with WPF or Silverlight.

If you give more details on what you're trying to achieve and the technology you're using I could give a more complete answer.

.net - textbox in new thread - Stack Overflow

.net c#-4.0
Rectangle 27 2

Assuming the database update is working correctly, the problem is that you are binding the GridView on every PostBack, but not after the data is updated.

When you click your button, you should see that your Page_Load method is called, your GridView is bound, then your lnkSaveComment_Click method is called, updating the database. But afterwards, you are not rebinding with the new data.

So my guess is that if you were to click the update button again (or cause another PostBack somehow), your new data would show up.

The fix would be to make sure you bind your GridView again after you update the data.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    
    If Not IsPostBack Then
        BindGridView()
    End If    
End Sub

Sub lnkSaveComment_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim myRow = sender.parent
    Dim mydata As New Profile_Data
    Dim IdNumber As String = CType(myRow.FindControl("hdnCommentID"), HiddenField).Value
    Dim text As String = CType(myRow.FindControl("txtEditCommentPopup"), TextBox).Text

    mydata.UpdateComment(IdNumber, text)

    BindGridView()

    Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "CloseWindowScript", "window.opener.location.href = window.opener.location;window.close();", True)
End Sub

Sub BindGridView()
    Dim IdNumber As Integer = Page.ClientQueryString
    Dim mydata As New Profile_Data

    gvCommentsEdit.DataSource = mydata.returnCommentsById(RequestedUsername, IdNumber)
    gvCommentsEdit.DataBind()
End Sub

You mean like doing a gvCommentsEdit.DataBind() as the first line in lnkSaveComment_Click? I tried that, but no change.

Hmm.. but lnkSaveComment_Click() gets called from the submit button (I.E., right after the edits), so the data has already changed by then, right? Not sure where else a DataBind() would make sense. Oh, there is a DataBind() in Page_Load, for what that's worth. Are you thinking of someplace else?

You are misunderstanding the ASP.NET Page Lifecycle. My answer explains this. When you click the button, your Page_Load gets called first and rebinds your GridView with the old data. Then your save handler gets called second, updates the database, but then does not rebind the GridView, leaving your GridView in an old state.

@box1763 before button click event page_load event occur first so it will bind new data each time as in your present code, thats why you are losing your data.

asp.net - vb.net TextBox submit not changing - Stack Overflow

asp.net vb.net gridview
Rectangle 27 1

You need to mention ValidationGroup for every textbox and button, as you are binding the accordion at runtime, so need to bind ValidationGroup at runtime with some property that has unique/different value for every accordian. Lets say you are binding accordion with rows of Groups, you can mention groupId in ValidationGroup then. Your updated code must looks alike:

<asp:RequiredFieldValidator ControlToValidate="txtNotes" Text="Note Field is Required" runat="server" ValidationGroup='<%# Eval("GroupId") %>'/>

 <asp:Button ID="btnSave" CssClass="searchbutton Accbtnsave" runat="server" CommandName="Save" Text="Save" ValidationGroup='<%# Eval("GroupId") %>'/>

This way each accordion has its own ValidationGroup and clicking on button will not fire the validators in other accordions

c# - Required Field Validator in Ajax Accordion Pane is not working - ...

c# asp.net ajax c#-4.0 asp.net-ajax
Rectangle 27 1

document.getElementById('<%= tbAdd_Sphone.ClientID %>')

instead of

document.getElementById('tbAdd_Sphone')
<%=
<% Response.Write(....)%>

I got error for that, Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

I check for alert. It show that onChange does not trigger because the alert popup window never show up.

html - asp.net/javascript, why is textbox onChange event does not fire...

javascript html asp.net
Rectangle 27 1

You cannot make change event just by setting value from javascript. Here is a sample by using trigger.

<script>
       $(document).ready(function () {

           $(".tbAdd_Sowner").on('change', function () {
               var owner = $('.tbAdd_Sowner').val();
               $('.tbAdd_Sphone').val(owner);
           });

           $(".aGetID").on('click', function () {
               var tbOwner = $('.tbAdd_Sowner');
               var hidden1 = $('.Hidden1');
               var hidden2 = $('.Hidden2');
               var hidden3 = $('.Hidden3');
               GalModalTOCCDialog(hidden1, tbOwner, hidden2, hidden3);

           });

           function GalModalTOCCDialog(Hidden1, tbAdd_Sowner, Hidden2, Hidden3) {
               $(tbAdd_Sowner).val(' ').trigger('change');
           }

           $('.tbAdd_Sowner').change(function () {
               $(this).removeAttr('disabled');

           });
       });
    </script>
<table>
        <tr>
            <td align="right">Secondary Owner
            </td>
            <td>
                <input id="Hidden1" type="hidden" value="1" class="Hidden1"  />
                <asp:TextBox ID="tbAdd_Sowner" OnTextChanged="tbAdd_Sowner_TextChanged" CssClass="tbAdd_Sowner" AutoPostBack="true" runat="server" Enabled="false"   ></asp:TextBox>
                <input id="Hidden2" type="hidden" class="Hidden2" />
                <input id="Hidden3" type="hidden" class="Hidden3" />
                <a href="javascript:void(0)" id="aGetID" class="aGetID" >Get User ID</a>

            </td>
        </tr>
        <tr>
            <td align="right">Secondary Owners</td>
            <td>
                <asp:TextBox ID="tbAdd_Sphone" runat="server" CssClass="tbAdd_Sphone" ></asp:TextBox>

            </td>
        </tr>
    </table>
protected void tbAdd_Sowner_TextChanged(object sender, EventArgs e)
        {
            tbAdd_Sowner.Text = "123";
        }

see Jquery #aGetID click event. YOu can get textobx values there too using $('#tbAdd_Sowner').val()

<a href="javascript:void(0)" onclick="GalModalTOCCDialog(ToName2, tbAdd_Powner, CCName2,CCUserID2)">
<a href="javascript:void(0)" id="aGetID" >Get User Name</a>

@StudentIT: ok you can check the Jquery now. I added your function back.

You cannot assume that "tbAdd_Sowner" remains the same since it is a server control. Depending on your settings, it is very likely that the ID changes is something like "ctl14_tbAdd_Sowner".

html - asp.net/javascript, why is textbox onChange event does not fire...

javascript html asp.net
Rectangle 27 1

Changing the value of tbAdd_Sowner through JavaScript (I assume through your GalModalTOCCDialog function) isn't going to fire the onchange event.

You can fire that event manually, after you set the value:

document.getElementById('tbAdd_Sowner').onchange();

Though I'm surprised you aren't have problems with getElementById like @IrfanTahirKheli showed, which should've worked fine for you... so there are likely missing pieces of your markup that we need to help you correctly.

Other things you need to strongly consider is to not use inline styling and not use tables for formatting.

Since you seem to have problems with what I added, here is another way. Remove the onChange from your asp:TextBox and just do it all from javascript:

document.getElementById('tbAdd_Sowner').value = 'somevalue';
 document.getElementById('tbAdd_Sowner').onchange = getUserID();

'tbAdd_Sowner' id did not change after rendering because OP did not use any container. You can find details here - MSDN- in description of AutiID. I would say using client Id may save us in many places, but probably not here.

@afzalulh Most likely, yes, the ID has changed on render. It doesn't matter if it is in a container or not. It is a server control.

Please check the link. Or test yourself with a server control in a page(without masterpage), and see rendered ID.

@afzalulh OK you are right if he isn't using masterpage. But since the ClientID didn't work for him you notice I left it out of my answer to begin with ;)

+1 @MikeSmithDev - I would have same answer for OP. About the ID, I tested his code putting the tr in a table and it gives me correct id: why should I bother about master page while he did not mention :-)

html - asp.net/javascript, why is textbox onChange event does not fire...

javascript html asp.net
Rectangle 27 0

You can actually extend your value change catching to all changes coming from some script using the jQuery val method, by setting a custom setter in jQuery.valHooks.

Imagine you change the input type to myCustomType, then you will implement jQuery.valHooks.myCustomType.set method which will be called each time val is used to set the input value, and you will include your specific call here. But I insist : it is not a best practice.

You will surely find explicit code on the web for that hooks.

textbox - How to capture change in text when that change is through ja...

javascript textbox onchange
Rectangle 27 0

This may be able to help (asp.net). This example adds up the total value of given controls and sets the value of the TotalScore TextBox to that value whenever the controls that have this onblur event loose focus

<asp:TextBox ID="GroupA" runat="server" onblur="Javascript:RecalculateScoreTotal();"  Width="50px"></asp:TextBox>
function RecalculateScoreTotal() {
        var tbA = parseInt(document.getElementById('<%=GroupA.ClientID%>').value.replace(/,/g,''));
        var tbB = parseInt(document.getElementById('<%=GroupB.ClientID%>').value.replace(/,/g, ''));
        var tbC = parseInt(document.getElementById('<%=GroupC.ClientID%>').value.replace(/,/g, ''));
        var tbD = parseInt(document.getElementById('<%=GroupD.ClientID%>').value.replace(/,/g, ''));
        var tbE = parseInt(document.getElementById('<%=GroupE.ClientID%>').value.replace(/,/g, ''));
        var tbF = parseInt(document.getElementById('<%=GroupF.ClientID%>').value.replace(/,/g, ''));
        var tbG = parseInt(document.getElementById('<%=GroupG.ClientID%>').value.replace(/,/g, ''));
        var total = tbA + tbB + tbC + tbD + tbE + tbF + tbG;
        document.getElementById('<%=TotalScore.ClientID%>').value = total;
    }

javascript - Why is onblur not working? - Stack Overflow

javascript html onblur
Rectangle 27 0

Put the not working code inside $(function () {

Element is not present at the time you are attaching the event,

@James123 make a fiddle .

i dont understand why this code not working my page. these controls in jQuery tab

asp.net - jQuery blur is not firing on textbox - Stack Overflow

jquery asp.net blur
Rectangle 27 0

I'm working on the assumption that this is an asp.net app?

If that's the case, the best approach is to make the radio button and the text postback by setting its Autopostback property to true. On server-side, check the combination and act accordingly.

Use a Switch statement to check the age based on the rating selected.

You could wrap these in an UpdatePanel to prevent visible post-back.

rating_changed() {
   checkAge();
}

txtAge_changed() {
  checkAge();
}

void checkAge() {
  bool ageOkay = false;
  int age = Convert.ToInt32(txtAge.Text);

  switch (rating.SelectedItem.Value) {
     case "G":
        ageOkay = true;
        break;
     case "PG":
        if (age >= 8) ageOkay = true;
        break;
     case "PG-13":
        if (age >= 13) ageOkay = true;
        break;
  } 

if (ageOkay) {
  //do next task
} else {
  //you're not old enough
}
}

vb.net - Validating a number in a textbox [VB2010] - Stack Overflow

vb.net
Rectangle 27 0

List<IElement> elements = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlString), null);
//htmlString is your form html
foreach (IElement el in elements)
{
    pdfDoc.add(el);
}

pick textbox.text and then add it either as a paragraph or any other element. no other way

Thanks for reply.ok and what about dropdown list, radiobutton list and checkbox list?

asp.net - TextBox controls are not Working with Export To PDF(iTextSha...

asp.net c#-4.0 itextsharp