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. neel help plz...

neel help plz...

Scheduled Pinned Locked Moved ASP.NET
helptutorial
16 Posts 3 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 Amit Kumar Chikara

    If I am not wrong, you have added this drop down in the edit Item template of Datagrid. What you can do is, You can go to the HTML source code and where there you have added this Edit Item Template you can add an event for dropdown in the HTML code itself.

    Regards, Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD amit_chikara2002@hotmail.com

    P Offline
    P Offline
    pradeep kumarappagari
    wrote on last edited by
    #6

    yes your right i added dropdownlist in edit item template. how to add event i dont know plz tyell me the syntax

    Pradeep Reddy

    1 Reply Last reply
    0
    • _ _AK_

      What error?

      Best Regards, Apurva Kaushal

      P Offline
      P Offline
      pradeep kumarappagari
      wrote on last edited by
      #7

      Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

      Pradeep Reddy

      _ 1 Reply Last reply
      0
      • P pradeep kumarappagari

        Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

        Pradeep Reddy

        _ Offline
        _ Offline
        _AK_
        wrote on last edited by
        #8

        you try accessing the dropdownlist like this in the event: DropDownList list = (DropDownList)sender and then use it.

        Best Regards, Apurva Kaushal

        P 1 Reply Last reply
        0
        • _ _AK_

          you try accessing the dropdownlist like this in the event: DropDownList list = (DropDownList)sender and then use it.

          Best Regards, Apurva Kaushal

          P Offline
          P Offline
          pradeep kumarappagari
          wrote on last edited by
          #9

          sir can u plz explain me little bit clearly this

          Pradeep Reddy

          _ 1 Reply Last reply
          0
          • P pradeep kumarappagari

            sir can u plz explain me little bit clearly this

            Pradeep Reddy

            _ Offline
            _ Offline
            _AK_
            wrote on last edited by
            #10

            Actually why you were getting the error because you were not been able to get the control and then was using it that why you getting that object reference.. error. In you event just set the reference for the dropdownlist and check whether it works or not. suppose this your method: public void Test(object sender, System.EventArgs e) { DropDownList list = (DropDownList)sender; string hh = list.SelectedItem.ToString(); //to get the selected string. }

            Best Regards, Apurva Kaushal

            P 1 Reply Last reply
            0
            • _ _AK_

              Actually why you were getting the error because you were not been able to get the control and then was using it that why you getting that object reference.. error. In you event just set the reference for the dropdownlist and check whether it works or not. suppose this your method: public void Test(object sender, System.EventArgs e) { DropDownList list = (DropDownList)sender; string hh = list.SelectedItem.ToString(); //to get the selected string. }

              Best Regards, Apurva Kaushal

              P Offline
              P Offline
              pradeep kumarappagari
              wrote on last edited by
              #11

              thank u sir, i got it

              Pradeep Reddy

              _ 1 Reply Last reply
              0
              • P pradeep kumarappagari

                thank u sir, i got it

                Pradeep Reddy

                _ Offline
                _ Offline
                _AK_
                wrote on last edited by
                #12

                always welcome.. :) BTW one more thing don't call me sir, apurva will be ok. :)

                Best Regards, Apurva Kaushal

                P 1 Reply Last reply
                0
                • _ _AK_

                  always welcome.. :) BTW one more thing don't call me sir, apurva will be ok. :)

                  Best Regards, Apurva Kaushal

                  P Offline
                  P Offline
                  pradeep kumarappagari
                  wrote on last edited by
                  #13

                  public void aa(object sender,System.EventArgs e) { DropDownList dl=(DropDownList)sender; ss=dl.SelectedValue.ToString();----->this is working fine TextBox tb=(TextBox)DataGrid1.FindControl("TextBox1"); tb.Text=ss;------->this is giving error } -- modified at 1:13 Tuesday 12th September, 2006

                  Pradeep Reddy

                  _ 1 Reply Last reply
                  0
                  • P pradeep kumarappagari

                    public void aa(object sender,System.EventArgs e) { DropDownList dl=(DropDownList)sender; ss=dl.SelectedValue.ToString();----->this is working fine TextBox tb=(TextBox)DataGrid1.FindControl("TextBox1"); tb.Text=ss;------->this is giving error } -- modified at 1:13 Tuesday 12th September, 2006

                    Pradeep Reddy

                    _ Offline
                    _ Offline
                    _AK_
                    wrote on last edited by
                    #14

                    You can't get the textbox(which is inside the datagrid) like this. You need to have the find the index and then to find the control. Probably first get the datagrid item like this: TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; then you try to find the textbox control in it.

                    Best Regards, Apurva Kaushal

                    P 1 Reply Last reply
                    0
                    • _ _AK_

                      You can't get the textbox(which is inside the datagrid) like this. You need to have the find the index and then to find the control. Probably first get the datagrid item like this: TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; then you try to find the textbox control in it.

                      Best Regards, Apurva Kaushal

                      P Offline
                      P Offline
                      pradeep kumarappagari
                      wrote on last edited by
                      #15

                      TextBox tb1,tb2; DropDownList dl1,dl2; dl1=(DropDownList)sender; string ss=dl1.SelectedValue.ToString(); tb1=(TextBox)DataGrid1.Items[0](i was missing this).FindControl("TextBox3"); tb1.Text=ss; thank u i got the solution

                      Pradeep Reddy

                      _ 1 Reply Last reply
                      0
                      • P pradeep kumarappagari

                        TextBox tb1,tb2; DropDownList dl1,dl2; dl1=(DropDownList)sender; string ss=dl1.SelectedValue.ToString(); tb1=(TextBox)DataGrid1.Items[0](i was missing this).FindControl("TextBox3"); tb1.Text=ss; thank u i got the solution

                        Pradeep Reddy

                        _ Offline
                        _ Offline
                        _AK_
                        wrote on last edited by
                        #16

                        :)

                        Best Regards, Apurva Kaushal

                        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