Click here to Skip to main content
16,016,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to set default value in each column of gridview when add new record how can i do this
Posted

There is a property in EditColumns->DefaultCellStyle->NullValue.Set this property as your desired value.
 
Share this answer
 
Try :
XML
<asp:TextBox runat="server"
Text='<%#DefaultVal(Eval("FieldName").ToString())% >' ID="txtBox1"
></asp:TextBox>

and in the codeBehind:
C#
protected string DefaultVal(string val)
{
if(val == null)
return("0");
else
return(val);

}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900