Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
930 views
Hi, 

I am saving my grid data into sql database. But i getting error:
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 361:            cmd.Parameters("@DOC_Portions_Served_Adults_ALC").Value = str14
Line 362:            con.Open()
Line 363:            cmd.ExecuteNonQuery()
Line 364:
Line 365:            con.Close()
Stack Trace:
[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9594283
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
   System.String.System.IConvertible.ToInt32(IFormatProvider provider) +46
   System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +385
   System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +5034544

[FormatException: Failed to convert parameter value from a String to a Int32.]
   System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +5033757
   System.Data.SqlClient.SqlParameter.GetCoercedValue() +32
   System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) +103
   System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters) +126
   System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc) +73
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   DSS_Project.ProductionRecordmain.AddGrid() in C:\Documents and Settings\911313\My Documents\Visual Studio 2010\Projects\DSS Project\ProductionRecordmain.aspx.vb:363
   DSS_Project.ProductionRecordmain.btnsave_Click(Object sender, EventArgs e) in C:\Documents and Settings\911313\My Documents\Visual Studio 2010\Projects\DSS Project\ProductionRecordmain.aspx.vb:190
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Public Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsave.Click
        AddGrid()
    End Sub
Public Sub AddGrid()
        For Each item As GridDataItem In GD_Prod.Items

            ''''''getting the bound fields values 
            Dim str0 As String = item("port_recipe_num").Text
            Dim str1 As String = item("DESC_ALT").Text
            Dim str2 As String = item("port_no_servings").Text
            Dim str5 As String = item("STD_NUM_OF_SERVING").Text
            Dim str13 As String = item("POSStudents").Text
            Dim str14 As String = item("POSAdultsALC").Text
     
            ''''''getting the template fields value   
            Dim tx3 As TextBox = DirectCast(item.FindControl("TxtSTUPort"), TextBox)
            Dim tx4 As TextBox = DirectCast(item.FindControl("TxtAAPort"), TextBox)
            Dim tx6 As TextBox = DirectCast(item.FindControl("TxtFPort"), TextBox)
            Dim tx7 As TextBox = DirectCast(item.FindControl("TxtQoFUsed"), TextBox)
            Dim tx8 As TextBox = DirectCast(item.FindControl("TxtPPort"), TextBox)
            Dim tx9 As TextBox = DirectCast(item.FindControl("TxtLOPort"), TextBox)
            Dim tx10 As TextBox = DirectCast(item.FindControl("TxtBFPort"), TextBox)
            Dim tx11 As DropDownList = DirectCast(item.FindControl("ddlLOCode"), DropDownList)
            Dim tx12 As TextBox = DirectCast(item.FindControl("TxtTSPort"), TextBox)

            Dim str3 As String = (tx3.Text)
            Dim str4 As String = (tx4.Text)
            Dim str6 As String = (tx6.Text)
            Dim str7 As String = (tx7.Text)
            Dim str8 As String = (tx8.Text)
            Dim str9 As String = (tx9.Text)
            Dim str10 As String = (tx10.Text)
            Dim str11 As String = (tx11.SelectedItem.Value)
            Dim str12 As String = (tx12.Text)

            Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("FConnectionString").ConnectionString)
            Dim cmd As New SqlCommand("P_FN_PR_InsertGridData", con)
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Parameters.Add("@Pkey", Data.SqlDbType.Char)
            cmd.Parameters("@Pkey").Value = lblPKey.Text.Trim
            cmd.Parameters.Add("@PL_Recipe_Number", Data.SqlDbType.Char)
            cmd.Parameters("@PL_Recipe_Number").Value = str0
            cmd.Parameters.Add("@PL_Recipe_Name", Data.SqlDbType.Char)
            cmd.Parameters("@PL_Recipe_Name").Value = str1
            cmd.Parameters.Add("@PL_Portion_Size", Data.SqlDbType.Char)
            cmd.Parameters("@PL_Portion_Size").Value = str2
            cmd.Parameters.Add("@PL_Student_Portions_Planned", Data.SqlDbType.Int)
            cmd.Parameters("@PL_Student_Portions_Planned").Value = str3
            cmd.Parameters.Add("@PL_Adults_ALC__Portions_Planned", Data.SqlDbType.Int)
            cmd.Parameters("@PL_Adults_ALC__Portions_Planned").Value = str4
            cmd.Parameters.Add("@PL_Total__Portions_Planned", Data.SqlDbType.Int)
            cmd.Parameters("@PL_Total__Portions_Planned").Value = str5
            cmd.Parameters.Add("@PL_Factor_Portions", Data.SqlDbType.Char)
            cmd.Parameters("@PL_Factor_Portions").Value = str6
            cmd.Parameters.Add("@DOC_Quantity_Of_Food_Used", Data.SqlDbType.Char)
            cmd.Parameters("@DOC_Quantity_Of_Food_Used").Value = str7
            cmd.Parameters.Add("@DOC_Portions_Prepared ", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Portions_Prepared ").Value = str8
            cmd.Parameters.Add("@DOC_Portions_Brought_Forward ", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Portions_Brought_Forward ").Value = str9
            cmd.Parameters.Add("@DOC_Portions_Leftover", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Portions_Leftover").Value = str10
            cmd.Parameters.Add("@DOC_Leftover_Code", Data.SqlDbType.Char)
            cmd.Parameters("@DOC_Leftover_Code").Value = str11
            cmd.Parameters.Add("@DOC_Total_Portions_Served", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Total_Portions_Served").Value = str12
            cmd.Parameters.Add("@DOC_Portions_Served_Students", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Portions_Served_Students").Value = str13
            cmd.Parameters.Add("@DOC_Portions_Served_Adults_ALC", Data.SqlDbType.Int)
            cmd.Parameters("@DOC_Portions_Served_Adults_ALC").Value = str14
            con.Open()
            cmd.ExecuteNonQuery ()
            con.Close()
Next
End Sub

Stored Procedure:
ALTER PROCEDURE [DBO].P_FN_PR_InsertGridData
(
@Pkey char(15) ,
@PL_Recipe_Number char(4),
@PL_Recipe_Name char(20),
@PL_Portion_Size char(6),
@PL_Student_Portions_Planned int,
@PL_Adults_ALC__Portions_Planned int,
@PL_Total__Portions_Planned int,
@PL_Factor_Portions char(10),
@DOC_Quantity_Of_Food_Used char(10),
@DOC_Portions_Prepared int,
@DOC_Portions_Brought_Forward int,
@DOC_Portions_Leftover int,
@DOC_Leftover_Code char(3),
@DOC_Total_Portions_Served int,
@DOC_Portions_Served_Students int,
@DOC_Portions_Served_Adults_ALC int
)
AS
INSERT INTO FNProdRecDetails (Date_Loc_Type, PL_Recipe_Number, PL_Recipe_Name, PL_Portion_Size, PL_Student_Portions_Planned, PL_Adults_ALC__Portions_Planned, 
PL_Total__Portions_Planned, PL_Factor_Portions, DOC_Quantity_Of_Food_Used, DOC_Portions_Prepared, DOC_Portions_Brought_Forward, DOC_Portions_Leftover,
DOC_Leftover_Code, DOC_Total_Portions_Served, DOC_Portions_Served_Students, DOC_Portions_Served_Adults_ALC)
VALUES (@Pkey , @PL_Recipe_Number, @PL_Recipe_Name, @PL_Portion_Size, @PL_Student_Portions_Planned, @PL_Adults_ALC__Portions_Planned,
@PL_Total__Portions_Planned, @PL_Factor_Portions, @DOC_Quantity_Of_Food_Used, @DOC_Portions_Prepared, @DOC_Portions_Brought_Forward, @DOC_Portions_Leftover,
@DOC_Leftover_Code, @DOC_Total_Portions_Served, @DOC_Portions_Served_Students, @DOC_Portions_Served_Adults_ALC)
Tsvetina
Telerik team
 answered on 01 Feb 2011
5 answers
108 views
Our users really liked the way how filter option is displayed on MVC grids vs RadGrid.

Is there any way I can get the same behavior in RadGrid.

Attached are images for comparison.

Thanks
vas
Top achievements
Rank 1
 answered on 01 Feb 2011
9 answers
159 views
I have a page that dynamically builds RadPanelItems and adds them to an empty RadPanelBar in my aspx page. the number of these RadPanelItems could be 5 or it could be 505 so I need a way to control how big my page gets.

Is there a way of paging the number of RadPanelItems that are shown in a RaadPanelBar? I've thought about creating a brand new RadPanelBar for each item and putting them in a grid, but what complicates matters is that each RadPanelItem has a dynamically created grid inside!

What I effectively need need is the following...

RadGrid (paged)
    row 
        RadPanelBar
            RadPanelItem (Dynamically created)
                RadGrid (Dynamically created)
    row
        RadPanelBar
            RadPanelItem (Dynamically created)
                RadGrid (Dynamically created)
    row
        RadPanelBar
            RadPanelItem (Dynamically created)
                RadGrid (Dynamically created)

etc.

It would be so much easier if I could just say on a single RadPanelBar "PageSize=10", but then I guess this isnt really what the panel bar was designed for.

Any suggestions?
Karl
Top achievements
Rank 1
 answered on 01 Feb 2011
1 answer
130 views
Hello
OnValuechanged  event is getting fired on pageLoad
radtxtSubject textbox is placed in usercontrol1.ascx page
usercontrol1.ascx is placed in default.aspx page
when ever i am getting in to default.aspx page OnValueChanged event is getting fired
 
<telerik:RadTextBox ID="radtxtSubject" runat="server"  >
   <ClientEvents OnValueChanged="GetChanges" />
    </telerik:RadTextBox>
 
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
function GetChanges(Sender,EventArgs)
{
 alert('Hello');
  
}
</script>
    </telerik:RadScriptBlock>
alekhya
Top achievements
Rank 1
 answered on 01 Feb 2011
5 answers
612 views

Developing along fine... played with Silverlight for a while... went back to AJAX for now...
Nice stuff going on... good widgets...

I downloaded and installed the 2009 Q2 release and I am having all kinds of problems.
I removed the reference to the old dll and added reference to the new dll - still get riddled with problems...

e.g.,
Error creating template groups. Reason: System.InvalidCastException: Unable to
cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.RadGrid'.
  at Telerik.Web.Design.RadGridDesigner.get_GridComponent()
  at Telerik.Web.Design.RadGridDesigner.get_TemplateGroups()

this comes out of nowhere... on three grids on the page...

e.g., just adding a simple Combobox I get the message in the DEVELOPMENT environment
Error Creating Control - RadComboBox1
Unable to cast object of type 'Telerik.Web.UI.RadComboBox' to type 'Telerik.Web.UI.ControlItemContainer

My guess is that I have a reference somewhere that still needs cleaning up... any ideas?

Chris

PS NEVER MIND!
Though I did change the reference to the new binary... for some reason the system did not update the bin directory with the new dll...
Sorry I didn't see it quicker!

C
Sebastian
Telerik team
 answered on 01 Feb 2011
1 answer
151 views
hi all,

This is annaji very new for telerik controls. I created  a list in share point designer 2010. wher i used different text boxes for different fields. Now here i want to add Rad controls for all these text boxes for a list. Can any body tell me that how can i add an telerik controls for a list in sharepoint 2010.


Thanks,
annaji.mantha
Prangadj
Top achievements
Rank 1
 answered on 01 Feb 2011
1 answer
105 views
Hi,

  Do you plan to integrate in the future a grammatical corrector  with radspell ?

thanks,
J-Francois
Rumen
Telerik team
 answered on 01 Feb 2011
1 answer
198 views
Hi All,
I am trying to get a Multiline RadTextBox to correctly size to 100% height. It seems that it ignores my height requirements and goes solely by the Row property (which I can't seem to disable).
This does not suit my variable layout.
Can you please describe a way to achieve my goal?
Thanks,
Steele.
alekhya
Top achievements
Rank 1
 answered on 01 Feb 2011
3 answers
189 views
I'm having trouble figuring out how to apply a left border to the first "cell" in an expanded item.  I have applied a bottom border to all cells in the parent row except for the expand/collapse row, and I wanted to apply a left border so that it makes a right angle with the bottom border of the parent row...what would be the best way to approach this?  Below is the code I am using for the bottom border of the parent row.

if (OrdersGrid.Items.Count > 1)
{
  for (int i = 0; i < OrdersGrid.Items.Count - 1; i++)
  {
    GridItem item = OrdersGrid.Items[i];
 
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = @"1px solid #828282;";
  }
}
else if (OrdersGrid.Items.Count == 1)
{
  GridItem item = OrdersGrid.Items[0];
  if (OrdersGrid.Items[0].Expanded)
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = @"1px solid #828282;";
  else
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = "none;";
}
Shinu
Top achievements
Rank 2
 answered on 01 Feb 2011
4 answers
156 views
I took your example from Grid/Herarchy With Templates, other than the database fields being different the only change I made was to replace:

this
<img  src='<%#  Page.ResolveUrl("~/Grid/Examples/Hierarchy/NestedViewTemplate/Img/") + (Container.FindControl("Label1") as Label).Text %>.jpg' alt="Customer Image" />

with this:
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource4"
    <ItemTemplate> 
        <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" 
            DataValue='<%#Eval("Avatar") %>' Width="90px" Height="110px" ResizeMode="Fit"/> 
    </ItemTemplate> 
</asp:DataList> 
 

I need to retrieve the image from the database.
The first image is correct, but all images after that fail.  When I modify the PreRender to loop through each item and expand each item it works fine, for the first page (the second page is all empty images).

I have a feeling this is going to be a dumb mistake by me, please help.

Here is what it looks like:

Kiara
Top achievements
Rank 1
 answered on 01 Feb 2011
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?