Add space to string in c#

Hi, here i have to remind  we can add specified space or byte to existing string.

string spacestr = "123";
spacestr = spacestr .ToString().PadRight(10 , '*'); //for asterisk   
(OR)
spacestring  = spacestring  .ToString().PadRight(10 , ' '); //for space

now 'spacestr ' value will be :123*******, the seven * will added to right side of the 'spacestr .
 (OR)
now 'spacestr ' value will be :123       , the seven sapce will added to right side of the 'spacestr .

if we need to add space left side of str
spacestr = spacestr .ToString().PadLeft(10 , '*');

now 'spacestr ' value will be :*******123, the * will added to left side of the spacestr .
Probably we need space, we replace space ' ' character instead of  asterisk '*' 

Next line in single node in xml

if We need,we can use next line in single node, example below

First we have to know how much bytes construct a line in the xmlnode,
so manually we add empty space after a value
<Student address='raj       9865812345INDIA     '></student>
here we have 3 inner line, each line have 10 bytes.


Hide status bar of Link button

Hide status bar of link button 
We have use the below code to disable status bar of link button in IE, can't in FireFox. 
 
<asp:LinkButton ID="lnkbutn" onMouseOver="window.status='';" onMouseOut="window.status='';"  
oncontextmenu="window.status='';" runat="server" Visible="false"  
OnClick="lnkbutn_click"> >> Next </asp:LinkButton>

the parameterized query which was not supplied

This error will raise while the passing parameters with NULL values, we can handle this exception 
if(LoanRefNo!=null)
{
 parameters.Add("@lRefNo", SqlDbType.NVarChar, LoanRefNo, 50);
}
else{
  parameters.Add("@lRefNo", SqlDbType.NVarChar,DBNull.Value, 50);
}

textmode password field blank when using wizard

The Textbox's Text Mode is password when using it in Wizard or Multiview the text values will get clear while moving to another view or wizard, So in like that situation we go to ViewState or Session,Dont go for hidden Field cause we can see hidden field values in View Source,so its not secure.

ViewState["mypass"] = txtPassword.Text;
Multiview1.ActiveViewIndex =1;

Select and Delete multiple rows using Linq

Here am using two line statement to select multiple rows and delete the same in proper way.

 var result = Context.tablename.Where(data => data.fk_applicantID== 21);
 Context.tablename.DeleteAllOnSubmit(result);

Context is the instance of Linq Data Context .

small things may help lot. 

----------------------------------------------------------------------------- 

Additionally want to know this: Garbage Collection


CONVERT VS TRY_CONVERT IN SQL 2012



Sys is not defined




I faced this problem, i did what had mentioned in the above screen shot. Its working fine for me.