You must Sign In to post a response.
  • Category: ASP.NET

    Need to set the status as default in asp.net

    need to set the status as default in asp.net

    i have id from (1 to 10)


    my need is

    id section stauts

    1 BM Present

    3 SS Present


    no 2 is absent i need to set the id 2 as absent without entry.
  • #750027
    You can store the value in hidden field and use it anywhere you want as you dont want to display it if i am right then assign the value in a hidden field which will not be visible to user but still you can use it.
    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #750028
    Hai Selvi,
    I think you can use default values in the database table so that when you are not entering anything, it should take the value as "Absent" when the entry is not made.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #750032
    but daily i need to do it ah. please explain it clearly

  • #750050
    Hi Selvi,

    While creating the table itself, define the default value. So whenever no data will be entered for any particular field, it will be marked as "Default". Please do this like below-

    Create table attendence
    (
    Id int primary key identity(1,1),
    Name varchar(40),
    status varchar(10) Default 'Abscent'
    )

    Try this. It's definitely going to help.

    Thanks,
    Ashutosh Jha
    http://tricksroad.com

  • #750081
    Hi,

    If you want to set the Default value while user doesn't enter any value then use Default Constraint in SQL using this it's replaced null value with default value while you doesn't enter value into that.

    https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=default%20constraint%20in%20sql

    Refer above link for more details..

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #750082
    Hi,

    Where you need to set the default value, I mean in which control you need to set that whether that is DropDownList control or any other controls.?

    Better to set the default constraint in SQL side. Use Default Constraint in SQL, using this it's replaced null value with default value while you doesn't enter value into that.

    https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=default%20constraint%20in%20sql

    Refer above link for more details..

    If you don't want to set this, then use ISNULL function in SQL to replace null with default value.

    ISNULL(Col,'Absent');

    Hope this will help you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #750143
    please share ur link clearly (https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=default%20constraint%20in%20sql)



    naveensanagasetti

  • #750161
    Default value in database will not help you, default value can be set to a 'column' not for a specific entry so if you want to take use of it then you need to add a 'varchar' column in database with the default value as 'Absent' so when you enter some id and does not enter value for that column it will take it as 'Absent'
    But any how you need to enter values in database.
    Without entering values in database you can not insert 'Absent' as defualt

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #760961
    Hi
    selvi

    --If you need automatically update without entry means
    --You can use service or sql jobs for this
    --You can go through below links

    http://stackoverflow.com/questions/14210599/how-to-update-a-table-in-sql-2008-on-daily-weekly-basis
    https://msdn.microsoft.com/en-us/library/ms187910.aspx

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments