neel help plz...
-
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
yes your right i added dropdownlist in edit item template. how to add event i dont know plz tyell me the syntax
Pradeep Reddy
-
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
-
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
-
you try accessing the dropdownlist like this in the event: DropDownList list = (DropDownList)sender and then use it.
Best Regards, Apurva Kaushal
sir can u plz explain me little bit clearly this
Pradeep Reddy
-
sir can u plz explain me little bit clearly this
Pradeep Reddy
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
-
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
thank u sir, i got it
Pradeep Reddy
-
thank u sir, i got it
Pradeep Reddy
-
always welcome.. :) BTW one more thing don't call me sir, apurva will be ok. :)
Best Regards, Apurva Kaushal
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
-
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
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
-
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
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
-
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