Telerik Forums
UI for ASP.NET AJAX Forum
13 answers
1.0K+ views
Hi,

Can you help me figure out how to retrieve a grid column value from GridTemplateColumn in code behind? I have a grid template column that uses a DataBinder.Eval but for some reason I can't figure how to retrieve the value in code behind. Here is the script...
<telerik:GridTemplateColumn DataField="Amount" HeaderText="Amount" UniqueName="Amount" >
                            <ItemStyle CssClass="ItemsGridAmount" BorderStyle="Solid" BorderColor="Black" BorderWidth="1" />
                            <HeaderStyle Width="85px" HorizontalAlign="Center" />
                        <ItemTemplate >
                            <asp:Label runat="server" style="position:relative; top:2px; margin-right:8px" ID="lblAmount" Text='<%# DataBinder.Eval (Container, "DataItem.Amount", "{0:F}") %>'>></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label runat="server" style="margin-right:10px" ID="lblAmount" Text='<%# DataBinder.Eval (Container, "DataItem.Amount", "{0:F}") %>'>></asp:Label>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
and here is the code behind...
ry
        {
            foreach (GridDataItem item in grdInvoiceItems.Items)
            {
                int id = (int)item.OwnerTableView.DataKeyValues[item.ItemIndex]["Id"];
                string lineItem = (item["Items"].FindControl("ddlItems") as RadComboBox).Text;
                string description = (item["Description"].FindControl("txtDescription") as RadTextBox).Text;
                double? price = (item["Price"].FindControl("txtPrice") as RadNumericTextBox).Value;
                double? qty = (item["Qty"].FindControl("txtQty") as RadNumericTextBox).Value;
                double? discount = (item["Discount"].FindControl("txtDiscount") as RadNumericTextBox).Value;
                //double tax = double.Parse(lblTaxes.Text);
                Label amount1 = (item["Amount"].FindControl("lblAmount") as Label);
                string amount = item["Amount"].Text;
 
                Invoice.UpdateInvoiceItems(id, lineItem, description, Convert.ToInt32(price),
                    Convert.ToInt32(qty), Convert.ToDouble(discount), 0, 100);
            }
        }
        catch (Exception ex)
        {
            lblErrorMsg.Text = ex.Message;
            this.Master.FindControl("ErrorContentPlaceHolder").Visible = true;
        }
Nothing I've tried seems to work thus far. Any help would be greatly appreciated.

Thanks,
Ron.
Jayesh Goyani
Top achievements
Rank 2
 answered on 05 Apr 2013
3 answers
433 views
Hi,
I am using Export to Excel in RadGrid control and i need to change the format of the Grid data that exported to the Excel file and I try to put my code in the event  'ExcelMLExportRowCreated', this event should fired when the grid export the rows to Excel but this not happened with me!! this event never fired I try to trace the project and this event not fired at all !!
Please help me to know where is the problem.
Thanks
Ban
Luke
Top achievements
Rank 2
 answered on 05 Apr 2013
9 answers
127 views
Hi,

I am getting following error while uploading files. To reproduce the issue, select multiple files and make sure that one of the file is open.

Please help me in handling this issue.

Microsoft JScript runtime error: Unhandled Error in Silverlight Application [IO.IO_SharingViolation_File]
Arguments: up-5.docx
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.51204.0&File=mscorlib.dll&Key=IO.IO_SharingViolation_File   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileInfo.OpenRead()
   at UploadPrototype.UploadContext.GetCurrentChunk()
   at UploadPrototype.MainPage.UploadRequest(StreamWriter writer, UploadContext context, Stream requestStream)
   at UploadPrototype.MainPage.ProcessRequest(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass9.<InvokeGetRequestStreamCallback>b__7(Object state2)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Hristo Valyavicharski
Telerik team
 answered on 05 Apr 2013
2 answers
193 views
I have a RadGridView where I would like the following behavior:
- only 1 or 0 rows can be selected at any given time
- if I click on a row that is unselected, then make only this row selected
- if I click on a row that is already selected, should be deselected

Can i get this behavior using client methods. 
Sunil
Top achievements
Rank 1
 answered on 05 Apr 2013
1 answer
124 views
Hello,

I have a RadAutoCompleteBox control within a RadGrid.  I am able to bind the control during the page load.  Although, when I start typing in the RadAutoCompletebox, I receive the following message.



Grid HTML:
 <telerik:GridTemplateColumn HeaderText="Media Title" UniqueName="MediaTitle" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="330px"  ItemStyle-Wrap="false">
                <ItemTemplate>
                   <telerik:RadAutoCompleteBox ID="cboMaster" InputType="Text" runat="server" Filter="Contains" Width="300px" DropDownWidth="250px">
                    </telerik:RadAutoCompleteBox>
                  </ItemTemplate>
                </telerik:GridTemplateColumn>

RadAutoCompleteBox Binding (Page_Load):
 cboMaster.DataValueField = "ID";
 cboMaster.DataTextField = "Title";
 cboMaster.DataSource = GetMediaSourceTitles();
 cboMaster.DataBind();

What am I missing so users can type in the RadAutoCompleteBox and display the matching entries?

Thank You in Advance!
Nencho
Telerik team
 answered on 05 Apr 2013
1 answer
95 views
Hi,

I have a RibbonBar menu that I am dynamically populating with a list of items.  Over time, this list has grown and now the list is going beyond the height of the browser, causing some items to be hidden and/or not easily accessible.  Is there a way I can correct this, maybe with a scroll or multiple columns, or something else? 

Thanks!
Richard
Kate
Telerik team
 answered on 05 Apr 2013
5 answers
167 views
Hi I have a 'Save' button on my page, and would like to make it refresh its url, so when I have created a new form from a grid, it can get its id, and not be '0'. I have a attached a sample and would like for it to change the circled part to its new ID when clicked. In sql DB it is set up to automacially increase when saved. It already does that, but in order to get the url, I have to manually close the radwindow and open it again from the grid. how can I do that?
Marin Bratanov
Telerik team
 answered on 05 Apr 2013
1 answer
270 views

I have a RadGrid that implements usercontrols as model popups for adding and editing items within the grid.  When the user presses the submit button on the usercontrol, the Update command is sent back to the grid.  The update is processed and if an error occurs, I cancel the update and show a RadNotification as a modal popup.  The RadNotification shows and I create a div with a background to make it modal.  So, the RadNotification is modal over the usercontrol which is modal over the grid.

 

This all works as expected in FireFox 19.  When I try it in IE8, the RadNotification is placed underneath the modal div and the usercontrol modal.  Also, the RadNotificaiton is always located at the bottom left of the screen below the rest of the page.

 

Why does this not work on IE8?

Marin Bratanov
Telerik team
 answered on 05 Apr 2013
4 answers
331 views
You know what would be nice? To be able to specify a title for a radalert box without having to specify the window sizes.

  radalert("You are doing it wrong", "Warning");


It'd be nice to just leave radalert to figure out the best size.

Just a thought

--
Stuart
Marin Bratanov
Telerik team
 answered on 05 Apr 2013
1 answer
123 views

Greetings - I host user control inside an update panel, this user control then contains sub user controls, I want to create something like a drop down load on demand tool tip using the following code.  It doesn't call the instances ajax update but i think the parent's.  How do I get this to work?


<
asp:UpdatePanel runat="server" UpdateMode="Conditional">

<ContentTemplate>

<telerik:RadToolTipManager runat="server" ID="MyRadToolTipManager1" Position="Center" RelativeTo="Element" Animation="Resize"

HideEvent="ManualClose" ShowEvent="OnMouseOver" ShowCallout="true"

RenderInPageRoot ="true"

Skin="Default" OnAjaxUpdate="OnMyRadToolTipManagerAjaxUpdate1" AutoTooltipify="false" >

<TargetControls>

<telerik:ToolTipTargetControl TargetControlID="MyLabel" Value="MyLabel" />

</TargetControls>

</telerik:RadToolTipManager>

<asp:Label runat="server" ID="MyLabel" Text="Content" />

</ContentTemplate>

</asp:UpdatePanel>

Marin Bratanov
Telerik team
 answered on 05 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?