Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
215 views
Code of .aspx Page

<telerik:RadGrid ID="RadGrid2" runat="server" OnItemDataBound="RadGrid2_ItemDataBound">
                    <MasterTableView ClientDataKeyNames="ID">
                        <Columns>
                            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Rights" HeaderText="Rights">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents>
                    </ClientSettings>
                </telerik:RadGrid>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AasthaaERP %>"
                    SelectCommand="SELECT * FROM [rights]"></asp:SqlDataSource>
                <telerik:RadContextMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true"
                    EnableShadows="true" OnItemClick="RadMenu1_ItemClick" Style="top: 544px; left: 548px">
                    <Items>
                        <telerik:RadMenuItem Text="Edit" ImageUrl="1303455785_pencil.png" />
                        <telerik:RadMenuItem Text="Delete" ImageUrl="1303455790_delete.png" />
                    </Items>
                </telerik:RadContextMenu>
 
 
Code of .aspx.cs Page:
 
On Page Load
string qrySearch = "Select * From Rights Where ID = '" + RadComboBox1.SelectedValue + "'";
        ds = obj.SelectQuery(qrySearch);
        RadGrid2.DataSource = ds;
        RadGrid2.DataBind();
 
 protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
    {
        foreach (GridDataItem item in RadGrid2.MasterTableView.Items)
        {
            if (item.Selected)
            {
 
                strtxt = item["ID"].Text.ToString();
                Session["EditID"] = strtxt;
 
            }
 
        }
}



It will Gives Following Error if I Try to Programmatically RadGrid..And Works well if I apply Datasource Directly..

System.IndexOutOfRangeException was unhandled by user code
  Message=There is no row at position 0.
  Source=System.Data
  StackTrace:
       at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)
       at System.Data.DataRowCollection.get_Item(Int32 index)
       at rights.RadMenu1_ItemClick(Object sender, RadMenuEventArgs e) in d:\Sharing\AasthaaERP\rights.aspx.cs:line 106
       at Telerik.Web.UI.RadMenu.RaiseMenuItemEvent(Object eventKey, RadMenuEventArgs e)
       at Telerik.Web.UI.RadMenu.OnItemClick(RadMenuEventArgs e)
       at Telerik.Web.UI.RadMenu.RaiseItemClick(ControlItem item)
       at Telerik.Web.UI.RadMenu.RaisePostBackEvent(String nodeIndex)
       at Telerik.Web.UI.RadMenu.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String nodeIndex)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:



How to Slve This Error..Please Guide
Shinu
Top achievements
Rank 2
 answered on 04 Jul 2011
2 answers
64 views
Hello,

I would like to make a page which content will change based on some criteria. For example the page will have a dropdown list and when the user selects the value "1" the page will contain a raddatetimepicker and a textbox. Or when the user selects the value "2" from the dropdown list,the page will contain 3 textboxes and 3 labels.

Could you please help me on that?Which approach should i use?

Regards,
Peny
Peny
Top achievements
Rank 1
 answered on 04 Jul 2011
4 answers
169 views
Hello,

I can easily display a radalert dialog from my C# codebehind with the following line of code:

RadAjaxManager1.ResponseScripts.Add(@"radalert('Record already exists.', 225, 110);"); 

I assumed that working with the confirm and prompt dialogs would be similar, so I tried the following:

RadAjaxManager1.ResponseScripts.Add(@"radprompt('Are you sure?', promptCallBackFn;"); 

But I cannot get the radprompt to even display (at this point I am only concerned with displaying the prompt). Am I wrong in assuming that I can treat these dialogs identically?

Thanks,
Marin Bratanov
Telerik team
 answered on 04 Jul 2011
3 answers
171 views
Hi All,

I'm able to use bordersize="0" on a splitter to make the outer borders disappear.  But inside that there is a sliding pane that I want to have a 1px border around - otherwise it looks kind of weird.  I can do that via some CSS as per examples in this forum however if I had a second sliding pane on that page the CSS would apply to that as well even if I didn't want it.

I'm about to look into if I can incorporate some form of id based selection into the CSS tag but beyond that is there a way yet to set the borders within the slidingpane's tag?

EDIT:
Trying out the instance based CSS doesn't work - perhaps because the ID isn't what you specify in the CSS but rather made up from the parent splitter name too or maybe because my CSS is so rusty!  The CSS I tried is shown below:

#Radslidingpane4 .RadSplitter .rspSlidePane .rspSlideContainer
{
    border:solid 1px black;       
}




Regards.

Jon
Marin Bratanov
Telerik team
 answered on 04 Jul 2011
6 answers
535 views
I'm using the MultipleFileSelection="Automatic" in AsyncUpload  (trail of 2010 Q2) to ensure multiple files can be uploaded. Everything goes well with the uploading of multiple files, but when I write the following code in the Button click event of my form I get an IOException (File Could not find file 'C:\{app dir}\App_Data\RadUploadTemp\3yvza1nr.zhh'.):

            foreach (UploadedFile file in AsyncUpload1.UploadedFiles)
            {
                business.AddPhto(file.InputStream);
            }


The weird thing is that I can see that temporary files are deleted when the postback happends. Sometimes all files are gone, sometimes all the files are there.
My question is: How do I use the uploaded files and what should I do to prevent deletion of temporary files before I have the chance to handle them.

Kind regards,

Michel
Peter Filipov
Telerik team
 answered on 04 Jul 2011
1 answer
92 views
Have a need to make a one section of pageview persist over the child tabs clicks.  For example; have a tab named Other Info.  With in that tab there are 3 sub tabs.  There is common info across all of the sub tabs.  Any ideas on how to get this to work?
Plamen
Telerik team
 answered on 04 Jul 2011
1 answer
121 views
hello.. well i think the title says it all.. here's a detailed description of the issue im having..

the setup..
- an application that has a radscheduler control embedded..
- an sql database that stores appointment information..
- a webservice that allows insert, update and delete operations to be performed on the database and allows the application to get a list of appointments..

the work flow..
- the page loads with the schedulers default view set to daily..
- double clicking opens a custom form (by hooking onclientinserting) which allows the user to enter information..
- closing the custom form saves the information to the database and refreshes the parent page which contains the radscheduler control..
- upon page refresh, a webservice call is made to the database to fetch rows.. these are converted to datatables with appropriate column names and bound to the control.. the datatable is saved in session..
- when the page refreshes, the control correctly shows all instances of the recurring appointment during that day..

the problem..
- when the view is changed (to lets say week or month) or the date is changed to some other day, the control is rebound to the session datatable..
- i have a method for radscheduler_databound which is called AFTER binding has been done..
- by placing a watch on radscheduler.appointments[] array and checking the properties of each appointment, i find that they are the SAME appointments that were there in the last view..
- by running the code and when the page displays, i find:
    - day view (different date): NO recurrent appointments for the new date..
    - week / month view: ONLY those recurrent appointments that were visible in the view those appointments were created in (in this case.. the whole month is blank with recurrent appointments showing only for the day when they were created in..

i hope you understand the jist of the problem.. im sorry i cant produce a test project which isolates the problem as the application is very complicated.. i had the understanding that when a datatable is bound or rebound to radscheduler, it automatically generates recurrence instances on-the-fly.. what can i possibly be missing?

asim sohail..
Peter
Telerik team
 answered on 04 Jul 2011
1 answer
125 views
Hi,
   
 I would like to know if there is a way to solve my problem, the thing is that we have a costum control (EditorDropDownList) and on IE (6-7-8-9) every time I click outside of the radeditor frame the cusor focus is lost. Afterward when I try to paste something using the PasteHTML function of my costum control, it pastes at a semi-random position (at the begining or at the very end).
Could there be a way to solve my problem.

Also I dont know if you notice but the Télérik view is kind of messed up on IE 9 RC and Beta.

Thanks a lot for your time

Maxime Nadeau
Rumen
Telerik team
 answered on 04 Jul 2011
1 answer
223 views
I use FormDecorator to style buttons in my application with Office2007 skin. I especially like effect that hovered buttons have. Can I set in code behind that not-hovered button will look like hovered somehow?
Bozhidar
Telerik team
 answered on 04 Jul 2011
7 answers
92 views
I have been searching all morning for a demo or example of inserting a record into a child grid in a hierarchical grid to no avail. The odd thing is, that this was working at one point and I am not sure what changed.

It's a fairly simple grid. The problem I am having is that in the InsertCommand method when I extract the values I see the keys of the two columns I am looking for but the values are always null. Any insight as to what I am doing wrong would be greatly appreciated!

My grid:

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCommand="ViewResponse"
    OnSortCommand="RadGrid1_SortCommand" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnPageSizeChanged="RadGrid1_PageSizeChanged" Skin="Office2007"
    ShowStatusBar="true" Width="100%"  AllowSorting="True" AllowPaging="True" PageSize="20" OnNeedDataSource="GridNeedsDataSource" OnPreRender="RadGrid1_PreRender"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" >
    <MasterTableView DataKeyNames="response_id, survey_id, email_sent_history_id" >                                    
        <DetailTables>
            <telerik:GridTableView DataKeyNames="email_sent_history_id" Name="Calls" Width="100%" runat="server" CommandItemDisplay="Top">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="email_sent_history_id" MasterKeyField="email_sent_history_id" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridDateTimeColumn HeaderText="Call Date" DataField="call_date" UniqueName="call_date" PickerType="DatePicker">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn HeaderText="Call Outcome" DataField="call_outcome" UniqueName="call_outcome">
                    </telerik:GridBoundColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridBoundColumn DataField="email_sent_history_id" UniqueName="ResponseId" Visible="false" />
            <telerik:GridBoundColumn DataField="response_id" UniqueName="ResponseId" Visible="false" />
            <telerik:GridBoundColumn UniqueName="first_name" DataField="first_name" HeaderText="First Name" />                                        
            <telerik:GridBoundColumn  DataField="last_name" HeaderText="Last Name" />                                        
            <telerik:GridBoundColumn  DataField="organization" HeaderText="Organization" />
            <telerik:GridBoundColumn  DataField="pi_name" Headertext="PI Name" />
            <telerik:GridBoundColumn  DataField="response_date" DataFormatString="{0:MM/dd/yyyy}"  Headertext="Response Date" />
            <telerik:GridBoundColumn  DataField="current_status" HeaderText="Survey Status" />                                       
            <telerik:GridBoundColumn  DataField="score" Headertext="Score" />
            <telerik:GridButtonColumn UniqueName="Response" Text="View" HeaderText="Response" CommandName="ViewResponse"/>                                     
            <telerik:GridBoundColumn  DataField="feasibility_status" HeaderText="feasibility_status" />                                                                                     
        </Columns>                      
        <PagerStyle AlwaysVisible="True" Mode="NextPrevAndNumeric" Position="TopAndBottom"></PagerStyle>
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="true" />
    </ClientSettings>
</telerik:RadGrid>

My insertcommand method
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
        {
            GridEditFormInsertItem item = e.Item as GridEditFormInsertItem;
            if (item == null)
            {
                return;
            }
 
            string errorString = string.Empty;
            Hashtable values = new Hashtable();
            item.ExtractValues(values);
            try
            {
                var callDate = values["call_date"] == null ? string.Empty : values["call_date"].ToString();
                var callOutcome = values["call_outcome"] == null ? string.Empty : values["call_outcome"].ToString();
 
                /*Do some error checking and update the DB if we have values. callDate and callOutcome are always an empty string!*/
                 
            }
            catch (Exception ex)
            {
 
                RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", ex.Message)));
                e.Canceled = true;
            }
        }

I put a comment in place of where I am actually doing to the insert into the db because I figured it wasn't relevant. When I view the values HashTable in debug mode, after extracting the values. I can see that it has the two datakeys: call_date and call_outcome, but the values are always null....

thanks for any help!
Iana Tsolova
Telerik team
 answered on 04 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?