Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Validations in gridview

Validations in gridview

Scheduled Pinned Locked Moved ASP.NET
cssdatabasehelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anujose
    wrote on last edited by
    #1

    :) i want to validate a databound column and a template column in a datagridview.Databound colum i am displaying from database and in template colum i am allowing the user to enter a value.when user is entering value in template column i want to check whether the user enterd value is less than or equal to the value of databound column....How can i do this......... Can anyone can help me...give some samples also........ Anu Anu

    V 1 Reply Last reply
    0
    • A anujose

      :) i want to validate a databound column and a template column in a datagridview.Databound colum i am displaying from database and in template colum i am allowing the user to enter a value.when user is entering value in template column i want to check whether the user enterd value is less than or equal to the value of databound column....How can i do this......... Can anyone can help me...give some samples also........ Anu Anu

      V Offline
      V Offline
      VenkataRamana Gali
      wrote on last edited by
      #2

      anu, In RowDataBound Event write this code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int dbValue = (int)e.Row.Cells[0].Text; TextBox txtbox = (TextBox)e.Row.FindControl("TextBox1"); txtbox.Attributes.Add("onblur", "validateValue('"+ dbValue +"','"+ (int)txtbox.Text +"');"); } } add this javascript code in head section function validateValue(dbvalue, enteredValue) { if(enteredValue < dbvalue) { alert("please enter the value equal or greate of column1 "); } } hope this will help, as per the ur requirement fire this javascript validation related event. :)

      regards GV Ramana

      A 1 Reply Last reply
      0
      • V VenkataRamana Gali

        anu, In RowDataBound Event write this code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int dbValue = (int)e.Row.Cells[0].Text; TextBox txtbox = (TextBox)e.Row.FindControl("TextBox1"); txtbox.Attributes.Add("onblur", "validateValue('"+ dbValue +"','"+ (int)txtbox.Text +"');"); } } add this javascript code in head section function validateValue(dbvalue, enteredValue) { if(enteredValue < dbvalue) { alert("please enter the value equal or greate of column1 "); } } hope this will help, as per the ur requirement fire this javascript validation related event. :)

        regards GV Ramana

        A Offline
        A Offline
        anujose
        wrote on last edited by
        #3

        How i can assignto gridview colum what i typed in template colum textbox

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups