<telerik:GridTemplateColumn UniqueName="doc_name_org" HeaderText="Document">
<HeaderStyle CssClass="colored_header" Width="40%" />
<ItemStyle CssClass="colored" Width="40%" />
<ItemTemplate>
<asp:ImageButton ID="lnk_doc_name_org_img" Style="border: 0px; vertical-align: middle;" runat="server" />
<asp:HyperLink ID="lnk_doc_name_org_txt" runat="server"></asp:HyperLink>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFileName" CssClass="small" Style="float: left" runat="server" Text="" Width="60%"></asp:TextBox>
<input type="button" style="float: right" causesvalidation="false" id="btnGetExtraDoc" runat="server" class="button_small" value="Get document" />
</EditItemTemplate>
</telerik:GridTemplateColumn>
Handling the ItemTemplate was ok, but the EditItemTemplate was a bit more tricky.
Every example I came across used this methode to get the value from the textbox txtFileName
Dim DocName As String = TryCast(editedItem("doc_name_org").Controls(0), TextBox).Text
But of course it was not that simple. It turned out that I had to use .Controls(1) to get the textbox value.
I find this a bit confusing because I actually would expect the textbox to be control(0) and the button to be control(1)....
Any explenations for this? Is control(0) the ItemTemplate and Control(1) the EditTemplate?
If so, I must have missed this explenation somewhere....
To remove the posibility of messing this up later on I figured I should use another approach that does not relay on me to get the index right.
So, the following line accomplishes the same result, but more failsafe. I can add/remove controls without any damage.
Dim DocName2 As String = TryCast(e.Item.FindControl("txtFileName"), TextBox).Text
I think the examples for Telerik Controls should also demonstrate more complex implementations and give explenations for them, not just basic implementations.
Hope this helps someone.
regards
Alexander
| <script type="text/javascript"> |
| function openRadWindow() |
| { |
| var oWnd = radopen("DesktopModules/Calendar/AppointmentForms/UploadFiles.aspx", "RadWindow1" ); |
| oWnd.center(); |
| } |
| </script> |
| <telerik:RadWindowManager ShowContentDuringLoad="false" AutoSize="false" Skin="Vista" ID="RadWindowManager1" runat="server" VisibleStatusbar="false" Height="300px" Width="400px"> <Windows> <telerik:RadWindow ID="RadWindow1" runat="server" Title="File Upload" Height="300px" Width="400px" Left="200px" DestroyOnClose="true" VisibleStatusbar="false" ReloadOnShow="true" /> </Windows> </telerik:RadWindowManager> <
asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls">
|
| <asp:Label runat="server" ID="lblAttachment"><%# ShowAttachments() %> </asp:Label><br /> |
| <a href="#" onclick="openRadWindow(); return false;">Add files</a> |
If e.CommandName = "Edit" Then
Dim index As Integer = e.Item.ItemIndex
Dim item As Telerik.Web.UI.GridDataItem = RadGrid1.Items(index)
Dim nitem As Integer
nitem = Server.HtmlDecode(item("pnv_id").Text)
textBox1.text=nitem
End If
I M using EditPopupForm mode..when i click on edit Button inside grid.Popup Form Appears but .textbox value is Not Changed
Please Suugest a Solution for This.
| function AppointmentInserting(sender, eventArgs) { |
| var start = formatDate(eventArgs.get_startTime()); |
| // New appointment |
| window.radopen("AdvancedForm.aspx?Mode=Insert&Start=" + start+"&Studio="+ groupby , "AdvancedForm"); |
| eventArgs.set_cancel(true); |
| } |
| var groupby = sender.get_groupBy() |