Hello,
I've looked throughout this forum, but I was not able to find the answer to my problem.
I am tasked to open the EditMode of a RadGrid in the codebehind for a webform to add a new item and this is what I use:
RadGrid1.MasterTableView.InsertItem();
The "EditMode" of the RadGrid is set to "PopUp", and the code above works just fine. It opens the popup form if I were to put the code above in the click event of a button or Page_Load, for example.
My problem is that I have to send a value to an ASP text box in a databound template column within this popup "Edit" form from another page, but I'm unable to gain access to the template Item's text box on the popup edit form.
So, basically the steps would be like so:
1- the user clicks a link on a separate page, and either through session or querytring a value is sent to the page that contanins my RadGrid1.
2- the page containing the RadGrid1 opens, and the popup edit form is already open with the text of the querystring or session variable visible within the "AnnouncementsTextBox" textbox.
How do I go about populating the text box in the popup edit form?
Any help would be very much appreciated.
Here's the code for the template column:
Here's the code I've tried to use to set the value in the textbox:
I've looked throughout this forum, but I was not able to find the answer to my problem.
I am tasked to open the EditMode of a RadGrid in the codebehind for a webform to add a new item and this is what I use:
RadGrid1.MasterTableView.InsertItem();
The "EditMode" of the RadGrid is set to "PopUp", and the code above works just fine. It opens the popup form if I were to put the code above in the click event of a button or Page_Load, for example.
My problem is that I have to send a value to an ASP text box in a databound template column within this popup "Edit" form from another page, but I'm unable to gain access to the template Item's text box on the popup edit form.
So, basically the steps would be like so:
1- the user clicks a link on a separate page, and either through session or querytring a value is sent to the page that contanins my RadGrid1.
2- the page containing the RadGrid1 opens, and the popup edit form is already open with the text of the querystring or session variable visible within the "AnnouncementsTextBox" textbox.
How do I go about populating the text box in the popup edit form?
Any help would be very much appreciated.
Here's the code for the template column:
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"Announcements"
UniqueName
=
"AnnouncementsText"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"AnnouncementsTextBox"
runat
=
"server"
Text
=
'<%# Bind("Announcements") %'
></
asp:TextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"AnnouncementsLabel"
runat
=
"server"
Text
=
'<%# Eval("Announcements") %'
></
asp:Label
>
</
ItemTemplate
>
</
teleric:GridTemplateColumn
>
</
Columns
>
Here's the code I've tried to use to set the value in the textbox:
foreach
(GridDataItem item
in
RadGrid.Items)
{
TextBox tb = (TextBox)item.FindControl(
"AnnouncementTextBox"
);
tb.Text =
"This is where the QueryString text would go."
;
}