Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
115 views
Hi

I have developed a UserControl I am using as an inserts form in the radgrid.
I have use one of your tutorials as template. My problem is when I press insert in the UserControl the I do not get any data transferred to the database and I will therefore not be able to see anything in the radgrid. My primary key gets updated both in the database and the radgrid. When I debug I got all the data with me until the AcceptChanges method in RadGrid_1_InsertCommand. Hope anyone can help me with this problem. I have enclosed the code below.
btw. Im using Visual Studio 2008 and .Net 3.5

Best regards

Torben Sandberg



 

using

System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Telerik.Web.UI;
using WebApplicationProtoypeZenith;
using Telerik.QuickStart;

 

namespace WebApplicationProtoypeZenith
{
    
public partial class Admin : System.Web.UI.Page
    
{
        
private static DataTable GetDataTable(string queryString)
        {
            
String ConnString = ConfigurationManager.ConnectionStrings["SysnetDenmarkConnectionString"].ConnectionString;
            
SqlConnection MySqlConnection = new SqlConnection(ConnString);
            
SqlDataAdapter MySqlDataAdapter = new SqlDataAdapter();
            MySqlDataAdapter.SelectCommand =
new SqlCommand(queryString, MySqlConnection);
            
DataTable myDataTable = new DataTable();
            MySqlConnection.Open();
            
try
            {
                MySqlDataAdapter.Fill(myDataTable);
             }

            finally
            
{
                MySqlConnection.Close();
            }

            return myDataTable;
    }

    private DataTable Projects
    {
        
get
        
{
            
object obj = this.Session["Project"];
             
if ((!(obj == null)))
            {
                
return ((DataTable)(obj));
            }
            
DataTable myDataTable = new DataTable();
            myDataTable = GetDataTable(
"SELECT * FROM Project");
            
this.Session["Project"] = myDataTable;
            
return myDataTable;
        }
    }

    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        
this.RadGrid1.DataSource = this.Projects;
        
this.Projects.PrimaryKey = new DataColumn[] { this.Projects.Columns["ProjectId"] };
    }
    
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
    {
        
GridEditableItem editedItem = e.Item as GridEditableItem;
        
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

//Create new row in the DataSource
        
DataRow newRow = this.Projects.NewRow();

//Insert new values
        
Hashtable newValues = new Hashtable();
        newValues[
"ProjectName"] = (userControl.FindControl("RadTextBoxProjectName") as RadTextBox).Text;
        newValues[
"ProjectResume"] = (userControl.FindControl("RadEditor1") as RadEditor).Content;
        newValues[
"ProjectStart"] = (userControl.FindControl("RadDatePickerProjectStart") as RadDatePicker).SelectedDate;
        newValues[
"ProjectEnd"] = (userControl.FindControl("RadDatePickerProjectEnd") as RadDatePicker).SelectedDate;
        newValues[
"Responsible"] = (userControl.FindControl("RadTextBoxResponsible") as RadTextBox).Text;
        newValues[
"OrderdBy"] = (userControl.FindControl("RadTextBoxOrderdBy") as RadTextBox).Text;
        newValues[
"Contact"] = (userControl.FindControl("RadTextBoxContact") as RadTextBox).Text;

//make sure that unique primary key value is generated for the inserted row 
        
newValues["ProjectId"] = (int)this.Projects.Rows[this.Projects.Rows.Count - 1]["ProjectId"] + 1;
        
try
        
{
            
foreach (DictionaryEntry entry in newValues)
            {
                newRow[(
string)entry.Key] = entry.Value;
            }
        
this.Projects.Rows.Add(newRow);
        
this.Projects.AcceptChanges();
    }
        
catch (SqlException ecx)
        {
        RadGrid1.Controls.Add(
new LiteralControl("Unable to update/insert Projects. Reason: " + ecx.StackTrace));
         }

        catch (Exception ex)
        {
            RadGrid1.Controls.Add(
new LiteralControl("Unable to update/insert Projects. Reason: " + ex.Message));
            e.Canceled =
true;
        }

    }

}

 

 

 

 

Veli
Telerik team
 answered on 04 Sep 2008
3 answers
127 views

For some reason i can not get the default text to display more than one word. if there is a space in the call to radprompt only the characters before the space are shown in the textbox. I am using the latest ajax control and the default radprompt.

radprompt(
'Type:', promptEditToolBarType, 330, 100, null, 'Edit Toolbar Name', 'My Toolbar');

this displays only 'My' in the textbox.

Georgi Tunev
Telerik team
 answered on 04 Sep 2008
3 answers
152 views
Hi,

When i disable a radcombo, the control which displays the text is displayed as disabled whereas the dropdown image is displayed as enabled (I mean its displayed in blue color but am not able to click which is fine). I use the skin Outlook. How to make the combo image as disabled.

Regards

Sujith
Alex Gyoshev
Telerik team
 answered on 04 Sep 2008
11 answers
261 views
Not sure what you want in the way of examples so let me know.

In Outlook if you create an all day appointment and try to print a month calendar you get a 1/4 " block and the letters get truncated at the end (if you have that many).

If you take the same appointment and give it a start time - Outlook suddenly creates a vertical task on the month calendar and you get almost unlimited text and it just looks better.

I need my scheduler to look like option 2.  My client wants to print this calendar showing 1 months activities at a time on 1 page of a pdf.  Typically they get about 3 activities on a day max and all 3 print off enough text to see what it is.  I can send you an example of that if you need it.

I just can't figure out how to make the scheduler give anymore to an appointment on a month view than the 1 line.

Finally - I have my schedule color coded - and when they print it out either to a printer or pdf file, the colors vanish which also defeats the purpose of this.

Thanks in advance!!

Rich
Alex Gyoshev
Telerik team
 answered on 04 Sep 2008
3 answers
110 views
Hi,
Radcombobox not enable first time, it work second time when page get refreshed.
Please suggest.
Thanks,
Puru
Georgi Tunev
Telerik team
 answered on 04 Sep 2008
1 answer
72 views
How to add item into radcombobox , after closing radwindow of the child form.
The some value comes into the radcombobox with closing of the child form as radwindow.
The combobox should add that item into that and its looks in edited mode. no changes should took place. it would be possible that without refressing the radgrid edit template add some items into that, or any other idea to do this.
Thanks,
Puru
Georgi Tunev
Telerik team
 answered on 04 Sep 2008
7 answers
243 views
Hello!

I have a chart filled with some series, mostly line series. I am using the zoom and scrollfunction and i have some questions...

Why doesn't the chart support zoom and scroll when the chart includes a bar serie among the line series... (bug or feature), I understand that a zoom-function in a bar chart wouldn't be of much use but when you combine the line and bar chart it becomes useable. (The same issue with gantt chart)

My second question/bugreport is that, when i'm zooming an area the scrollbar takes up some of the chartspace and that's a big issue for me since i only have a low (in height) chart. Is it possible to put the scrollbar beneath the chart and above the gradings, not IN the chart?

/Davy Wester
Sorin
Top achievements
Rank 1
 answered on 04 Sep 2008
7 answers
633 views
Hello!
I've expired a strange problem when i tried to use RadColorPicker in my web application. I Have included the Server tag like this: 

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

I have also added the files "Telerik.Web.UI.dll"  and "Telerik.Web.UI.XML" to the bin map. In the code behind i find the classes included in Telerik.Web.UI but in the aspx-file i cannot find the controls such as ColorPickerItem ect. (for example:

<telerik:RadColorPicker runat="server" ID="RadColorPicker2" Columns="5" Width="210">

This row gives the error message in design mode "Unrecognized tag prefix or device filter 'telerik'."

When i try the application i get the errormessage: "Unknown server tag 'telerik:RadColorPicker'" Other Server tags works find in this file.
Regards
/Per

 

Tervel
Telerik team
 answered on 04 Sep 2008
1 answer
63 views
I have uses Rotator in my application and i want to redirect my page on IMageButton Click and also want to send some data with the querystring.


 Plz Anyone Help me.

 Thanks
Georgi Tunev
Telerik team
 answered on 04 Sep 2008
3 answers
155 views
Hi,

I need to build a simple task manager.  I need to be able to automatically adjust the start and finish dates for new tasks, if I change the start/finish date of a task.

Does the RAD Scheduler have this feature built in, or will I need to write code to accomplish this?  Do you have sample code that demonstrates this?

Appreciate any help you can provide.

Thanks,
Kalindi
Peter
Telerik team
 answered on 04 Sep 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?