Click here to Skip to main content
Rate this: bad
good
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.
 
Example:-
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
ntitish1.5K
Edited 10-Jul-13 21:49pm
v4

1 solution

Rate this: bad
good
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");
  Permalink  
v2
Comments
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 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 544
2 Maciej Los 325
3 DamithSL 223
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,712
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2014
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