Hello,
I have a quick question;
I use the following method to expand and collapse grid rows (client side) when I have a hierarchical grid;
*****************************************
var RadGrid1 = $find("<%= RadGrid1.ClientID %>");
for (var i = 0; i < RadGrid1.get_masterTableView().get_dataItems().length; i++) {
var item = RadGrid1.get_masterTableView().get_dataItems()[i];
var MasterTable = RadGrid1.get_masterTableView();
var row = RadGrid1.get_masterTableView().get_dataItems()[i];
var cell = MasterTable.getCellByColumnUniqueName(row, "ExpandColumn");
if (cell.innerHTML != "") {
if (gridExpanded == false) {
item.set_expanded(true);
gridChanged2 = true;
}
else {
item.set_expanded(false);
gridChanged2 = false;
}
}
}
gridExpanded = gridChanged2;
*****************************************
But now I need to expand and collapse a rid that is setup with Groups or "GroupBy" with GroupHeaders via client side code and I can't seem to find the proper object / property to make it work.
Can you please point me in the right direction? How do I expand and collapse a grid with client side code that is grouped?
Many thanks in advance,
Dave
function
OnMainMenuItemClick(sender, args) // fine
{
var itemText = args.get_item();
if(itemText.get_text() == "NoteBook")
{
$find(
"<%= RadGrid_NoteBook.ClientID %>").get_element().style.display = "";
$find(
"<%= RadGrid_Networks.ClientID %>").get_element().style.display = "none";
$find(
"<%= RadGrid_Friends.ClientID %>").get_element().style.display = "none";
}
else if(itemText.get_text() == "Networks")
{
$find(
"<%= RadGrid_NoteBook.ClientID %>").get_element().style.display = "none";
$find(
"<%= RadGrid_Friends.ClientID %>").get_element().style.display = "none";
$find(
"<%= RadGrid_Networks.ClientID %>").get_element().style.display = "";
}
else if(itemText.get_text() == "Friends")
{
$find(
"<%= RadGrid_NoteBook.ClientID %>").get_element().style.display = "none";
$find(
"<%= RadGrid_Networks.ClientID %>").get_element().style.display = "none";
$find(
"<%= RadGrid_Friends.ClientID %>").get_element().style.display = "";
}
}
Dim imageManager_parameters As New Editor.DialogControls.FileManagerDialogParameters
Dim imagePath As String() = {"~/App_Themes/images"}
With imageManager_parameters
.ViewPaths = imagePath
.SearchPatterns = New String() {"*.jpg"}
.MaxUploadFileSize = 5000000
End With
Dim imageManager_dialogDefinition As New DialogDefinition(GetType(Editor.DialogControls.ImageManagerDialog), imageManager_parameters)
With imageManager_dialogDefinition
.ClientCallbackFunction = "set_Image"
.Width = Unit.Pixel(694)
.Height = Unit.Pixel(440)
End With
telerik_imageManager.DialogDefinitions.Add("ImageManager", imageManager_dialogDefinition)
I am trying to code an upload page that does the following:
a. If they do, then an error message stating which file is a duplicate is displayed to the user on the postback.
b. If all files (1 to 5) do not exist, then they are saved to server, the SQL table is updated with the new file names, locations, etc.
I have the upload section working well as well as the writing the new file information to the correct table but I cannot get the file exists check code to work properly.
Here's what I have...
| Imports Telerik.Web.UI | |
| Imports System.IO | |
| Imports System.Data.SqlClient | |
| Imports Telerik.Web.UI.Upload | |
| Protected Sub RadUpload1_FileExists(ByVal sender As Object, ByVal e As UploadedFileEventArgs) Handles RadUpload1.FileExists | |
| Dim file As UploadedFile = e.UploadedFile | |
| 'Session("UserDir") comes from other working code | |
| Dim targetFolder As String = Session("UserDir") | |
| Dim targetFileName As String = System.IO.Path.Combine(targetFolder, file.GetExtension) | |
| While System.IO.File.Exists(targetFileName) | |
| 'Sets error label to visable and displays message. | |
| lblUploadError.Visible = True | |
| lblUploadError.Text = "File name already exists!" | |
| End While | |
| End Sub | |
| Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click | |
| If RadUpload1.UploadedFiles.Count > 0 Then | |
| System.Threading.Thread.Sleep(3000) | |
| End If | |
| For Each f As UploadedFile In RadUpload1.UploadedFiles | |
| f.SaveAs(Session("UserDir") & f.GetName, False) | |
| ' Insert a new record into Call_Info table | |
| 'Set Active Date on new user to today | |
| Dim UploadDate As DateTime = DateTime.Now | |
| Dim connectionString As String = ConfigurationManager.ConnectionStrings("eonPortalCS").ConnectionString | |
| Dim insertSql As String = "INSERT INTO Call_Info(UserId, File_Name, File_Location, Discipline, Call_Status, Upload_Date, Uploaded_By) VALUES(@UserId, @FileName, @FileLocation, @Discipline, @CallStatus, @UploadDate, @UploadedBy)" | |
| Dim myConnection As New System.Data.SqlClient.SqlConnection(connectionString) | |
| Dim myCommand As New System.Data.SqlClient.SqlCommand(insertSql, myConnection) | |
| Using myConnection | |
| myConnection.Open() | |
| myCommand.Parameters.AddWithValue("@UserId", Session("UploadUserID")) | |
| myCommand.Parameters.AddWithValue("@FileName", f.GetName) | |
| myCommand.Parameters.AddWithValue("@FileLocation", Session("UserDir")) | |
| myCommand.Parameters.AddWithValue("@Discipline", Session("UserDiscipline")) | |
| myCommand.Parameters.AddWithValue("@CallStatus", "New") | |
| myCommand.Parameters.AddWithValue("@UploadDate", UploadDate) | |
| myCommand.Parameters.AddWithValue("@UploadedBy", Session("CurrentUserGuid")) | |
| myCommand.ExecuteNonQuery() | |
| myConnection.Close() | |
| End Using | |
| Next | |
| RadUpload1.Enabled = False | |
| SubmitButton.Enabled = False | |
| Session("UploadUserID") = "" | |
| End Sub | |
Any suggestions?
Thanks,
Joe
| <Telerik:TimePicker ID="txtPlannedDuration" runat="server" Culture="French (Canada)" |
| Style="width: 58px; " TabIndex="322"> |
| <TimePopupButton CssClass="" ImageUrl="" HoverImageUrl=""></TimePopupButton> |
| <TimeView runat="server" CellSpacing="-1" Culture="French (Canada)" |
| Interval="00:30:00" Column="5"> |
| </TimeView> |
| <DateInput Width="" LabelCssClass=""> |
| </DateInput> |
| <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"> |
| </Calendar> |
| <DatePopupButton Visible="False" CssClass="" ImageUrl="" HoverImageUrl=""></DatePopupButton> |
| </Telerik:TimePicker> |
| <asp:Panel ID="toolBarPanel" runat="server"> |
| <radTlb:RadToolbar ID="toolBar" runat="server" UseFadeEffect="True" Skin="Mac" ButtonHeight="24px" |
| ButtonWidth="24px" AutoPostBack="true" CatalogIconImageUrl="" SkinsPath="~/RadControls/Toolbar/Skins" |
| ImagesDir="~/Imagenes/" OnOnClick="toolBar_OnClick" OnPreRender="toolBar_PreRender" |
| ValidationGroup="GV1" > |
| <Items> |
| <radTlb:RadToolbarButton ID="button1" ButtonImage="image1.png" CommandName="CMD1" |
| runat="server" ButtonText="CMD1" Hidden="False" CausesValidation="false" /> |
| <radTlb:RadToolbarButton ID="button2" ButtonImage="image2.png" CommandName="CMD2" |
| runat="server" ButtonText="CMD2" Hidden="False" CausesValidation="false" /> |
| </Items> |
| </radTlb:RadToolbar> |
| <script type="text/javascript"> |
| <!-- |
| <%= toolBar.ClientID %>.attachEvent("OnClientClick","click_handler"); |
| function click_handler(sender, e) |
| { |
| if (sender.CommandName=='DELETE') { |
| return confirm('<%= MissatgeDinamic("Del1") %>'); |
| } |
| } |
| --> |
| </script> |
| </asp:Panel> |
| <asp:Panel ID="toolBarPanel" runat="server"> |
| <telerik:RadToolBar ID="toolBar" runat="server" UseFadeEffect="True" Skin="Gray" ButtonHeight="24px" |
| ButtonWidth="24px" AutoPostBack="true" OnButtonClick="toolBar_OnButtonClick" OnPreRender="toolBar_PreRender" |
| ValidationGroup="GV1" > |
| <Items> |
| <telerik:RadToolbarButton ID="button1" ImageUrl="~/Imagenes/image1.png" CommandName="CM1" |
| runat="server" ButtonText="CMD1" Hidden="False" CausesValidation="false" /> |
| <telerik:RadToolbarButton ID="button2" ImageUrl="~/Imagenes/image2.png" CommandName="CM2" |
| runat="server" ButtonText="CMD2" Hidden="False" CausesValidation="false" /> |
| </Items> |
| </telerik:RadToolBar> |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
| <script type="text/javascript"> |
| $find("<%= toolBar.ClientID %>").attachEvent("OnClientClick","click_handler"); |
| function click_handler(sender, e) |
| { |
| if (sender.CommandName=='DELETE') { |
| return confirm('<%= MissatgeDinamic("Del1") %>'); |
| } |
| } |
| </script> |
| </telerik:RadCodeBlock> |
| </asp:Panel> |
| <div id="toolBar" class="RadToolBar RadToolBar_Horizontal RadToolBar_Gray RadToolBar_Gray_Horizontal " UseFadeEffect="True" ButtonHeight="24px" ButtonWidth="24px" style="z-index:9000;"> |
| <div class="rtbOuter"> |
| <div class="rtbMiddle"> |
| <div class="rtbInner"> |
| <ul class="rtbUL"> |
| <li class="rtbItem rtbBtn"><a class="rtbWrap" ID="button1" href="#"><span class="rtbOut"><span class="rtbMid"><span class="rtbIn"><img alt="" src="Imagenes/image1.png" class="rtbIcon" /></span></span></span></a></li><li class="rtbItem rtbBtn"><a class="rtbWrap" ID="button2" href="#"><span class="rtbOut"><span class="rtbMid"><span class="rtbIn"><img alt="" src="Imagenes/image2.png" class="rtbIcon" /></span></span></span></a></li> |
| </ul> |
| </div> |
| </div> |
| </div><input id="toolBar_ClientState" name="toolBar_ClientState" type="hidden" /> |
| </div> |
| <script type="text/javascript"> |
| $find("toolBar").attachEvent("OnClientClick","click_handler"); |
| function click_handler(sender, e) |
| { |
| if (sender.CommandName=='DELETE') { |
| return confirm('¿Seguro de borrar este elemento?'); |
| } |
| } |
| < |