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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. how t ofind the control in itemtemplate of datalist

how t ofind the control in itemtemplate of datalist

Scheduled Pinned Locked Moved ASP.NET
helptutorialannouncement
3 Posts 2 Posters 1 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.
  • S Offline
    S Offline
    sooreeagt
    wrote on last edited by
    #1

    Hi all.......... I am in a problem like.. I am using datalist item . In edit item template of datalist i have some controls like textbox. At the time update button click i need to validate the edit template.Here i need to validate one textbox with a date formate like dd/mm/yyyyy. I have the function of that date formate but when i am validating HOW TO FIND THE TEXT BOX.In itemdatabound event also i am not getting the control plz help me if any one have idea...

    Suresh.R

    D 1 Reply Last reply
    0
    • S sooreeagt

      Hi all.......... I am in a problem like.. I am using datalist item . In edit item template of datalist i have some controls like textbox. At the time update button click i need to validate the edit template.Here i need to validate one textbox with a date formate like dd/mm/yyyyy. I have the function of that date formate but when i am validating HOW TO FIND THE TEXT BOX.In itemdatabound event also i am not getting the control plz help me if any one have idea...

      Suresh.R

      D Offline
      D Offline
      DuckFace
      wrote on last edited by
      #2

      Hi, Not sure that this is what you are looking for, but here I go! You can get a reference to the control by using the FindControl method in the updateCommand method. With this reference you can cast it to the given control and then you can use the properties for that control. In the example I'm using a label: protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e) { Label lbl2 = (Label)DataList1.Items[e.Item.ItemIndex].FindControl("Label2"); Label1.Text += " " + lbl2.Text; } You can also assign values to the control, and update the datasource. Hope this helps.

      S 1 Reply Last reply
      0
      • D DuckFace

        Hi, Not sure that this is what you are looking for, but here I go! You can get a reference to the control by using the FindControl method in the updateCommand method. With this reference you can cast it to the given control and then you can use the properties for that control. In the example I'm using a label: protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e) { Label lbl2 = (Label)DataList1.Items[e.Item.ItemIndex].FindControl("Label2"); Label1.Text += " " + lbl2.Text; } You can also assign values to the control, and update the datasource. Hope this helps.

        S Offline
        S Offline
        sooreeagt
        wrote on last edited by
        #3

        Hi DuckFace Thank you for ur response. I will try to work it out. If find any problem then i will keep a message

        Suresh.R

        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