locked
Textbox Value RRS feed

  • Question

  • User-797751191 posted

    Hi

      i have belwo code and i want if there is value in txtLocation then txtValue should be displayed else Space

    cmd0.Parameters.AddWithValue("@Location", txtLocation.Text);

    Thanks

    Monday, June 24, 2019 11:05 AM

Answers

  • User-1038772411 posted

    Hello jsshivalik,

    Try with this

    var value = !string.IsNullOrWhiteSpace(txtLocation.Text) ? txtLocation.Text : " ";
    cmd0.Parameters.AddWithValue("@Location", value);

    Thank you.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 24, 2019 1:08 PM