I tried to get a cell value from the Radgrid on clicking the button that is also present inside the radgrid. Both the label & buttons are in the GridTemplatecolumn.
Aspx file
<telerik:GridTemplateColumn FilterControlAltText="Filter Status column"
HeaderText="Status" SortExpression="Status asc" UniqueName="Status">
<ItemTemplate>
<asp:Label ID="lblStatusText" Text='<%# Eval("Status")%>' runat="server"></asp:Label><asp:Button ID="btnChangeStatus" runat="server" Text="Change Status" onclick="btnChangeStatus_Click" />
</ItemTemplate>
</telerik:GridTemplateColumn>
Aspx.cs file:
protected void btnChangeStatus_Click(object sender, EventArgs e)
{
foreach (GridDataItem item in RadGrid2.Items)
{
Label lb = (Label)item.FindControl("lblStatusText");
Label lbOrder = (Label)item.FindControl("lblOrder");
string TemplateColumnValue = lb.Text;
string orderno = lbOrder.Text;
}
}
Wat i get as o/p is the last row value of the radgrid in the particular page instead i want the cell values of the row on which the button is clicked. in this the lblOrder is a boundcolumn value.
Thanks
6 Answers, 1 is accepted
Try the following code to achieve the scenario.
C#:
protected
void
Button1_Click(
object
sender, EventArgs e)
{
Button btn = (Button)sender;
GridDataItem item = (GridDataItem)btn.NamingContainer;
TableCell cell = (TableCell)item[
"UniqueName"
];
string
value = cell.Text;
}
Thanks,
Princy.
protected void btnChangeStatus_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
GridDataItem item = (GridDataItem)btn.NamingContainer;Label lb= (Label)item.FindControl("lblStatusText" );
string TemplateColumnValue = lb.Text;
}
Hi
Princy
Can you solve this
Hi
I saw this url for Multiple column for Autocomplete following url . But here mention DatasourceID="Sqldatasource" but i need use this same sample for call asmx method how will do this any one guide me.
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx
How to Implementation AutoCompleteBox with Image for Ex:
My Control this but here i added this DataSourceID="SqlDataSource1" but no need this i need fetch the data from database using c# and list object
can you fixed this
<telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBox1" runat="server" Width="400" Height="400px"
EmptyMessage="Type an E-mail" DataSourceID="SqlDataSource1" DataTextField="ContactName"
OnItemDataBound="RadComboBox1_ItemDataBound">
</telerik:RadComboBox>
But My Need this
In my AutocompleteBox shows like this -> multiple column with image then c# list object using webservices for Data binding.
EMPID EMPNAME EMPIMAGE
100 NAME HERE IMAGE HERE
how will do this any one fixed this
Please submit a separate thread for every unrelated query you may have. This will help keep the information in a thread consistent and easier to find.
Regards,
Viktor Tachev
Telerik