## FieldAsk class

Implements the ASK field.

To learn more, visit the [Working with Fields](https://docs.aspose.com/words/net/working-with-fields/) documentation article.

```csharp
public class FieldAsk : Field
```

## Constructors

| Name | Description |
| --- | --- |
| [FieldAsk](fieldask/)() | The default constructor. |

## Properties

| Name | Description |
| --- | --- |
| [BookmarkName](../../aspose.words.fields/fieldask/bookmarkname/) { get; set; } | Gets or sets the name of the bookmark. |
| [DefaultResponse](../../aspose.words.fields/fieldask/defaultresponse/) { get; set; } | Gets or sets default user response (initial value contained in the prompt window). |
| [DisplayResult](../../aspose.words.fields/field/displayresult/) { get; } | Gets the text that represents the displayed field result. |
| [End](../../aspose.words.fields/field/end/) { get; } | Gets the node that represents the field end. |
| [Format](../../aspose.words.fields/field/format/) { get; } | Gets a [`FieldFormat`](../fieldformat/) object that provides typed access to field's formatting. |
| [IsDirty](../../aspose.words.fields/field/isdirty/) { get; set; } | Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document. |
| [IsLocked](../../aspose.words.fields/field/islocked/) { get; set; } | Gets or sets whether the field is locked (should not recalculate its result). |
| [LocaleId](../../aspose.words.fields/field/localeid/) { get; set; } | Gets or sets the LCID of the field. |
| [PromptOnceOnMailMerge](../../aspose.words.fields/fieldask/promptonceonmailmerge/) { get; set; } | Gets or sets whether the user response should be recieved once per a mail merge operation. |
| [PromptText](../../aspose.words.fields/fieldask/prompttext/) { get; set; } | Gets or sets the prompt text (the title of the prompt window). |
| [Result](../../aspose.words.fields/field/result/) { get; set; } | Gets or sets text that is between the field separator and field end. |
| [Separator](../../aspose.words.fields/field/separator/) { get; } | Gets the node that represents the field separator. Can be `null`. |
| [Start](../../aspose.words.fields/field/start/) { get; } | Gets the node that represents the start of the field. |
| virtual [Type](../../aspose.words.fields/field/type/) { get; } | Gets the Microsoft Word field type. |

## Methods

| Name | Description |
| --- | --- |
| [GetFieldCode](../../aspose.words.fields/field/getfieldcode/)() | Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included. |
| [GetFieldCode](../../aspose.words.fields/field/getfieldcode/)(*bool*) | Returns text between field start and field separator (or field end if there is no separator). |
| virtual [Remove](../../aspose.words.fields/field/remove/)() | Removes the field from the document. Returns a node right after the field. If the field's end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns `null`. |
| [Unlink](../../aspose.words.fields/field/unlink/)() | Performs the field unlink. |
| [Update](../../aspose.words.fields/field/update/)() | Performs the field update. Throws if the field is being updated already. |
| [Update](../../aspose.words.fields/field/update/)(*bool*) | Performs a field update. Throws if the field is being updated already. |

## Remarks

Prompts the user to enter information and assigns a bookmark to represent the user's response.

## Examples

Shows how to create an ASK field, and set its properties.

```csharp
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Place a field where the response to our ASK field will be placed.
FieldRef fieldRef = (FieldRef)builder.InsertField(FieldType.FieldRef, true);
fieldRef.BookmarkName = "MyAskField";
builder.Writeln();

Assert.That(fieldRef.GetFieldCode(), Is.EqualTo(" REF  MyAskField"));

// Insert the ASK field and edit its properties to reference our REF field by bookmark name.
FieldAsk fieldAsk = (FieldAsk)builder.InsertField(FieldType.FieldAsk, true);
fieldAsk.BookmarkName = "MyAskField";
fieldAsk.PromptText = "Please provide a response for this ASK field";
fieldAsk.DefaultResponse = "Response from within the field.";
fieldAsk.PromptOnceOnMailMerge = true;
builder.Writeln();

Assert.That(fieldAsk.GetFieldCode(), Is.EqualTo(" ASK  MyAskField \"Please provide a response for this ASK field\" \\d \"Response from within the field.\" \\o"));

// ASK fields apply the default response to their respective REF fields during a mail merge.
DataTable table = new DataTable("My Table");
table.Columns.Add("Column 1");
table.Rows.Add("Row 1");
table.Rows.Add("Row 2");

FieldMergeField fieldMergeField = (FieldMergeField)builder.InsertField(FieldType.FieldMergeField, true);
fieldMergeField.FieldName = "Column 1";

// We can modify or override the default response in our ASK fields with a custom prompt responder,
// which will occur during a mail merge.
doc.FieldOptions.UserPromptRespondent = new MyPromptRespondent();
doc.MailMerge.Execute(table);

doc.UpdateFields();
doc.Save(ArtifactsDir + "Field.ASK.docx");
```

Shows how to create an ASK field, and set its properties (MyPromptRespondent).

```csharp
/// <summary>
/// Prepends text to the default response of an ASK field during a mail merge.
/// </summary>
private class MyPromptRespondent : IFieldUserPromptRespondent
{
    public string Respond(string promptText, string defaultResponse)
    {
        return "Response from MyPromptRespondent. " + defaultResponse;
    }
}
```

### See Also

* class [Field](../field/)
* namespace [Aspose.Words.Fields](../../aspose.words.fields/)
* assembly [Aspose.Words](../../)
