Hi
I have below code and i want if there r 4 records then each record should get displayed as separate line in a message.
if (Result != null)
{
ShowMessage("Information : ", ddlBook.SelectedItem.Text + " has been done by " + Result.Name , "info");
}
Thanks
Anandu G NathPosted Dec 27, 2023, 8:32 AM
Anandu G NathPosted Dec 27, 2023, 8:31 AM
Cr BhargaviPosted Sep 20, 2023, 4:17 PM
Tuhin PaulPosted Apr 23, 2023, 2:22 AM
Providing the code snippet in a larger context:
when the user clicks a button to process some action, the btnProcess_Click event handler method is called. Inside this method, the DoSomeAction method is called to perform some action and return a list of Result objects. If the Result list is not null, a message is constructed using the ddlBook.SelectedItem.Text value (which is assumed to be a selected book from a dropdown list), along with the name of each Result object in the list. The Environment.NewLine method is used to add a line break after each record. The ShowMessage method is called with the constructed message and a message type (info in this case) to display the message to the user.
Brahma Prakash ShuklaPosted Apr 21, 2023, 6:34 AM
To display each record as a separate line in the message, you can modify the code like this:
Rajkiran SwainPosted Apr 4, 2023, 1:40 PM
You can modify the code to concatenate the message with a line break after each record. Here is an example:
Jignesh KumarPosted Apr 4, 2023, 1:16 PM
Hello Ramco,
Use this one,
Ramco RamcoPosted Apr 4, 2023, 11:38 AM
Hi Jignesh
what will be your ClientScript.RegisterStartupScript line
Thanks
Ramco RamcoPosted Apr 4, 2023, 10:19 AM
Hi Sachin
Below r the codes
Thanks
Ramco RamcoPosted Apr 4, 2023, 10:03 AM
Hi Sachin
not working . Message does not show up
Thanks
Sachin SinghPosted Apr 4, 2023, 9:46 AM
use
sb.Append(Environment.NewLine);
and
Text = System.Text.RegularExpressions.Regex.Replace(Text, @"\t|\r", " ");
if doesn't work share you JS function
Ramco RamcoPosted Apr 4, 2023, 9:32 AM
Hi Sachin
In debug it is showing - Uncaught SyntaxError: Invalid or unexpected token.
Secondly when i write like this then it shows message but line break is not inserted
s= System.Text.RegularExpressions.Regex.Replace(s, @"\t|\n|\r", " ");
Thanks
Sachin SinghPosted Apr 4, 2023, 9:27 AM
debug show popup function. inspect in browser and check the response.
Ramco RamcoPosted Apr 4, 2023, 9:17 AM
Hi Sachin
I have written like below . Message not getting displayed
Thanks
Sachin SinghPosted Apr 4, 2023, 8:56 AM
As you are appending new line (\n) so modify
to
Ramco RamcoPosted Apr 4, 2023, 8:09 AM
Hi
In text Visualizer it is showing correctly but in display it is not working
string s = sb.ToString();
ShowMessage("Book has been read by : ", s, "info");
Thanks
Ramco RamcoPosted Apr 4, 2023, 7:34 AM
Hi
Below is the complete code
Thanks
Jignesh KumarPosted Apr 4, 2023, 7:22 AM
last provided should work for you, How are you displaying on UI ?
One more you can try it out
,
Vishal YelvePosted Apr 4, 2023, 7:20 AM
Ramco,
Try this.
Ramco RamcoPosted Apr 4, 2023, 7:15 AM
Hi
It is displaying in continuation
Thanks
Vishal YelvePosted Apr 4, 2023, 7:10 AM
Try this
Jignesh KumarPosted Apr 4, 2023, 7:04 AM
Hello,
Can you please check this one, string builder has AppendLine() function which add line for you,
Ramco RamcoPosted Apr 4, 2023, 6:46 AM
Hi Jignesh
I want to add new line after every record. IT is returning all records
Thanks
Vishal YelvePosted Apr 4, 2023, 6:40 AM
Hi Ramco,
for new line use
Ramco RamcoPosted Apr 4, 2023, 2:59 AM
Hi Jignesh
I have written below code but it is not appending new line
Thanks
Jignesh KumarPosted Apr 3, 2023, 6:50 PM
Hello Ramco,
Are you getting 4 records in Result. IF yes then you can use loop and iterate through all element and append in string.