Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET SQL-Server
Actually i am saving two different text in one column. while binding that column to the textbox. i want to separate the two text and the second text should come in second line. this should happen while saving the data into the column only.then while retrieving the column simply the text should come in second line. is it possible.
text1=Hai this is nitish
text2=He is surya friend
above two text i will save in the single column.
while retrieving the text from the column in the textbox the text should be like below
Hai this is nitish
He is surya friend.
like the above text i want to see the text in textbox. while binding.
for example if we are binding to the label.simply we can save the text in database like below
Text1="Hai this is nitish"+" < br / > "+"He is surya friend"
if we save like above in database means while binding to the label it will take the data as shown below
Hai this is nitish
He is surya friend.

I request the people to say at least whether it is possible or not. so that i can search according to that....
Posted 10-Jul-13 20:09pm
Edited 10-Jul-13 21:49pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

i think its simple
you are inserting in one column suppose a so your query will be
insert into a values 'hai this is nitish' + '
' + 'He is surya friend.'
and when you binding to textbox should be split by
and bind into textbox
textBox.Text = textBox.Text.Replace("
", "\r\n");
ntitish at 11-Jul-13 2:59am
here problem is i am binding the data to text box through designing with data source .....
ntitish at 11-Jul-13 3:08am
for binding to the label if we want text in the second line means. we have to pass the <br/> in between the text and we can save in the database while retrieving the data from the database it automatically the text will come in second line because of <br/> like that there is no solution ha sir...
dholakiyaankit at 11-Jul-13 3:09am
then what's the issue try this <%#Eval("banner_url").toString().Replace("
", "\r\n") %>
ntitish at 11-Jul-13 3:14am
Sorry to ask this stupid question .....actually i had adought while saving only if i save like below means nsert into a values 'hai this is nitish' + '"\r\n"' + 'He is surya friend.'
ntitish at 11-Jul-13 3:16am
here below is my code sir.
string plan4 = row.ItemArray[2].ToString();
string POC = row.ItemArray[8].ToString();
string Text = plan4 + "< br/ >" + DateTime.Now.ToString() + POC;
SQLHelp datahelper1 = new SQLHelp();
string cmdText = "Update xCC_Diagnoses set Plan4='" + Text + "',currentplanofcare='' where DXID=" + Convert.ToInt32(row.ItemArray[6].ToString()) + "";
int j = datahelper1.Execute_datamodify_Proc(cmdText);

in place of < br / > what should i write sir.......
dholakiyaankit at 11-Jul-13 3:15am
user <br/> there will be problems while splitting values or as you wish
ntitish at 11-Jul-13 3:26am
Sir in the above line i given my code can u see that instead of <br /> can we write \r\n then is there any problem......
dholakiyaankit at 11-Jul-13 3:23am
Replace("<br/>", "\r\n");
ntitish at 11-Jul-13 3:30am
ok sir i am trying in my code.........

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

  Print Answers RSS
0 Peter Leow 368
1 Kornfeld Eliyahu Peter 220
2 Maciej Los 200
3 OriginalGriff 173
4 Sergey Alexandrovich Kryukov 152
0 OriginalGriff 383
1 Peter Leow 318
2 Kornfeld Eliyahu Peter 260
3 Maciej Los 230
4 Sergey Alexandrovich Kryukov 212

Advertise | Privacy | Mobile
Web01 | 2.8.150301.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100