3 Answers, 1 is accepted

sorry, i mistakenly submit the post,
my question is i have a radgrid with 2 GridTemplateColumn, one is a textbox inside and the other has a linkbutton.
when i click the link button, i want to get the text in that textbox, is this possible?
my code is like below:
<telerik:GridTemplateColumn UniqueName="TemplateColumn"
FilterControlAltText="Filter TemplateColumn column">
<ItemTemplate>
<asp:TextBox ID="txtRejectReason" runat="server"></asp:TextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="TemplateColumn" DataField="Name"
FilterControlAltText="Filter TemplateColumn column">
<ItemTemplate>
<asp:LinkButton ID="ImageButton2" runat="server" AlternateText="" OnCommand="Reject_Click" CommandArgument='<%# Eval("ID") %>'
Text="Reject" ForeColor="#993333" />
</ItemTemplate>
===========================================
protected void Reject_Click(object sender, EventArgs e)
{
string strID = ((System.Web.UI.WebControls.CommandEventArgs)(e)).CommandArgument.ToString();
int intResult = SqlHelper.ExecuteNonQuery("update [SAVLEAVE_OFFLINE].[dbo].[Leaves] set LeaveStatus= 'Rejected' where ID= " + strID + "");
RadGridApprove.Rebind();
RadGridLeaveHistory.Rebind();
RadNotification1.ContentIcon = "ok";
RadNotification1.Text = "Leave Rejected!";
RadNotification1.Show();
}
========================================
i want to get the textbox.text and use it in the sql command,
thanks in advance for any help!
You can use the following approach to achieve this requirement:
protected
void
ImageButton2_Command(
object
sender, CommandEventArgs e)
{
LinkButton button = sender
as
LinkButton;
GridDataItem item = button.NamingContainer
as
GridDataItem;
TextBox textBox = item[
"TemplateColumnTextBox"
].FindControl(
"txtRejectReason"
)
as
TextBox;
button.Text = textBox.Text;
}
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
