As the form is in ContentPlaceHolder of ContentPlage I ikplement the logic like this........
ContentPlaceHolder contentPage = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
RadButton radbutton1 = (RadButton)contentPage.FindControl("RadButton1");
after this the result in radbutton1 is null as it doesnt find the control RadButton1....
please help me in this
ContentPlaceHolder contentPage = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
RadButton radbutton1 = (RadButton)contentPage.FindControl("RadButton1");
after this the result in radbutton1 is null as it doesnt find the control RadButton1....
please help me in this
6 Answers, 1 is accepted
0
Gopi
Top achievements
Rank 2
answered on 30 Dec 2014, 01:20 PM
Pls dont forget that the code is in button click event..........its not a big deal in finding editcommand and other evnts need to find it in buttonclickevent
0
Hello Gopi,
I'm not sure that I understand your scenario completely.
Why are you looking for the button when you are going to use its click event to find the RadTreeList control? And are these two (RadButton, RadTreeList) located within the same placeholder or they reside on different pages?
Please provide more information about your scenario as this will help me give you a straight to the point answer.
Regards,
Daniel
Telerik
I'm not sure that I understand your scenario completely.
Why are you looking for the button when you are going to use its click event to find the RadTreeList control? And are these two (RadButton, RadTreeList) located within the same placeholder or they reside on different pages?
Please provide more information about your scenario as this will help me give you a straight to the point answer.
Regards,
Daniel
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Gopi
Top achievements
Rank 2
answered on 05 Jan 2015, 06:21 AM
Hello Daniel,
thanks for getting respond to my Request and I let u very clear on my requiremnt......
here I have a radtreelist like as in the picture below(1.PNG) there when I click on the edit icon I have panel(Capture.png) with selected rowRow Id and otherfiled values....when I click on the Update button I need to retrieve those values and store in a variable.......
thanks for getting respond to my Request and I let u very clear on my requiremnt......
here I have a radtreelist like as in the picture below(1.PNG) there when I click on the edit icon I have panel(Capture.png) with selected rowRow Id and otherfiled values....when I click on the Update button I need to retrieve those values and store in a variable.......
0
Gopi
Top achievements
Rank 2
answered on 05 Jan 2015, 06:24 AM
I can ake use of this code but there is no TreeListCommandEventArgs in click event of button..........
TreeListCommandEventArgs e1 = new TreeListCommandEventArgs(null, radbutton1.CommandArgument, e2);
TreeListDataItem dataItem = e1.Item as TreeListDataItem;
Hashtable table = new Hashtable();
table["PartyParentRowId"] = (dataItem.FindControl("Label1") as Label).Text;
table["PartyAlias"] = (dataItem.FindControl("Label2") as Label).Text;
TreeListCommandEventArgs e1 = new TreeListCommandEventArgs(null, radbutton1.CommandArgument, e2);
TreeListDataItem dataItem = e1.Item as TreeListDataItem;
Hashtable table = new Hashtable();
table["PartyParentRowId"] = (dataItem.FindControl("Label1") as Label).Text;
table["PartyAlias"] = (dataItem.FindControl("Label2") as Label).Text;
0
Gopi
Top achievements
Rank 2
answered on 05 Jan 2015, 06:27 AM
In order to add TreeListCommandEventArgs in button click I also implemented code like this.......
ContentPlaceHolder contentPage = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
RadButton radbutton1 = (RadButton)contentPage.FindControl("RadButton1");
object mysender = (object)radbutton1;
CommandEventArgs e2 = new CommandEventArgs(null, radbutton1.CommandArgument);
RadButton1_Click(mysender, e2);
TreeListCommandEventArgs e1 = new TreeListCommandEventArgs(null, radbutton1.CommandArgument, e2);
TreeListDataItem dataItem = e1.Item as TreeListDataItem;
Hashtable table = new Hashtable();
table["PartyParentRowId"] = (dataItem.FindControl("Label1") as Label).Text;
table["PartyAlias"] = (dataItem.FindControl("Label2") as Label).Text;
But here I am not able to find Radbutton inside the Radtreelist so that I am getting Error......
ContentPlaceHolder contentPage = Page.Master.FindControl("ContentPlaceHolder2") as ContentPlaceHolder;
RadButton radbutton1 = (RadButton)contentPage.FindControl("RadButton1");
object mysender = (object)radbutton1;
CommandEventArgs e2 = new CommandEventArgs(null, radbutton1.CommandArgument);
RadButton1_Click(mysender, e2);
TreeListCommandEventArgs e1 = new TreeListCommandEventArgs(null, radbutton1.CommandArgument, e2);
TreeListDataItem dataItem = e1.Item as TreeListDataItem;
Hashtable table = new Hashtable();
table["PartyParentRowId"] = (dataItem.FindControl("Label1") as Label).Text;
table["PartyAlias"] = (dataItem.FindControl("Label2") as Label).Text;
But here I am not able to find Radbutton inside the Radtreelist so that I am getting Error......
0
Gopi
Top achievements
Rank 2
answered on 07 Jan 2015, 04:43 AM
finally got the output with this..............
protected void RadButton1_Click(object sender, EventArgs e)
{
ContentPlaceHolder contentPage = this.Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
RadButton R = sender as RadButton;
RadButton radbutton1 = R.Parent.FindControl("RadButton1") as RadButton;
RadTextBox t = sender as RadTextBox;
RadTextBox t1 = R.Parent.FindControl("textbox") as RadTextBox;
Response.Redirect("WebForm1.aspx?PartyParentRowId="+ t1.Text);
}