Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
228 views
I am tring to rotate through my radgrid to get the information  to save. The insert works fine becuase I can response.write my sql statement and it goes in fine.  I gets through one rotation and then seems to break the second time around.  I don't get it, it seems to work but does not work.

Here is my Ragrid.
 <td><telerik:RadGrid ID="myGridDental" runat="server" Width="100%" BorderWidth="1px" CellPadding="6" GridLines="None" BorderColor="#404040">
                                                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="intQuestionId" HierarchyDefaultExpanded="false" HierarchyLoadMode="ServerBind"
                                                                BorderColor="#404040" Font-Size="12" Font-Names="Veranda,arial,sans-serif" HeaderStyle-HorizontalAlign="Center"
                                                                GridLines="Both" BorderWidth="1px" ExpandCollapseColumn-ButtonType="ImageButton" ExpandCollapseColumn-CollapseImageUrl="~/Images/30.png"
                                                                ExpandCollapseColumn-ExpandImageUrl="~/Images/29.png">
                                                                <AlternatingItemStyle BackColor="#B0C4DE" />
                                                                <HeaderStyle ForeColor="White" CssClass="backColor" BackColor="Steelblue" Font-Bold="true" BorderColor="#404040" BorderWidth="1px" />
                                                                <Columns>
                                                                    <telerik:GridBoundColumn DataField="strQuestion" HeaderText="Question" />
                                                                    <telerik:GridTemplateColumn HeaderText="Help">
                                                                         <ItemTemplate>
                                                                            <asp:HyperLink ID="hylAttach" runat="server" ImageUrl="~/Images/paperclip.png" NavigateUrl='<%# bind("strUrl") %>' Target="_blank"
                                                                            Visible='<%# Not String.IsNullOrEmpty(Eval("strUrl")) %>' />
                                                                         </ItemTemplate>
                                                                    </telerik:GridTemplateColumn>
                                                                    <telerik:GridTemplateColumn HeaderText="GO\NOGO">
                                                                        <ItemTemplate>
                                                                            <asp:RadioButtonList ID="rblDental" runat="server" RepeatDirection="Horizontal" CellPadding="5" CellSpacing="5" TextAlign="Right">
                                                                                <asp:ListItem Value="0" Text="GO" />
                                                                                <asp:ListItem Value="1" Text="NO\GO" />
                                                                            </asp:RadioButtonList>
                                                                            <asp:RequiredFieldValidator ID="valDRadio" runat="server" ControlToValidate="rblDental" ErrorMessage="Not Answered" ForeColor="Red" ValidationGroup="Dental" />
                                                                        </ItemTemplate>
                                                                    </telerik:GridTemplateColumn>
                                                                    <telerik:GridTemplateColumn HeaderText="Data">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox ID="txtData" runat="server" Width="60" />
                                                                        </ItemTemplate>
                                                                    </telerik:GridTemplateColumn>
                                                                    <telerik:GridTemplateColumn HeaderText="Remarks">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox ID="txtRemarks" runat="server" Width="200" />
                                                                        </ItemTemplate>
                                                                    </telerik:GridTemplateColumn>
                                                                    <telerik:GridTemplateColumn HeaderText="Record Date">
                                                                        <ItemTemplate>
                                                                            <asp:TextBox ID="txtCal" runat="server" Width="100" style="cursor:pointer" />
                                                                            <asp:CalendarExtender ID="txtCal_CalendarExtender" runat="server" TargetControlID="txtCal" />
                                                                        </ItemTemplate>
                                                                    </telerik:GridTemplateColumn>
                                                                </Columns>
                                                                <DetailTables>
                                                                    <telerik:GridTableView Name="mySubDental" runat="server" DataKeyNames="intQuestionId" TableLayout="Fixed" BorderWidth="1px" CellPadding="6" Font-Size="12" AutoGenerateColumns="False"
                                                                        HeaderStyle-HorizontalAlign="Center" BorderColor="#404040" Font-Names="Veranda,arial,sans-serif" GridLines="Both">
                                                                        <ParentTableRelation>
                                                                            <telerik:GridRelationFields DetailKeyField="intQuestionId" MasterKeyField="intQuestionId" />
                                                                        </ParentTableRelation>
                                                                        <HeaderStyle ForeColor="White" BackColor="SteelBlue" Font-Bold="true" HorizontalAlign="Center" />
                                                                        <Columns>
                                                                            <telerik:GridBoundColumn DataField="strTaskName" HeaderText="Task" />
                                                                            <telerik:GridBoundColumn DataField="dtFound" HeaderText="Date" />
                                                                            <telerik:GridBoundColumn DataField="strNotes" HeaderText="Remarks" />
                                                                        </Columns>
                                                                    </telerik:GridTableView>
                                                                </DetailTables>
                                                            </MasterTableView>
                                                        </telerik:RadGrid></td>
                                                    </tr>
                                                     <tr>
                                                        <td><asp:LinkButton ID="lnkSubmitDental" runat="server" ValidationGroup="Dental">Submit</asp:LinkButton></td>
                                                    </tr>
                                                </table>

Here is my code behind, it gets through one loop and then breaks and give me this error.

Object reference not set to an instance of an object.   and then point to my sql statement.

 Protected Sub lnkSubmitDental_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSubmitDental.Click
        Dim userlogon As String = Split(Current.User.Identity.Name, "\")(1)
        Dim lblErrorMsg As Label = DirectCast(Me.Master.FindControl("lblErrorMsg"), Label)
        Dim aError As HtmlAnchor = DirectCast(Me.Master.FindControl("aError"), HtmlAnchor)
        Dim lblError As Label = DirectCast(Me.Master.FindControl("lblError"), Label)
        Dim PersId As String = HFID.Value
        Dim AttendId As String = HFAttendID.Value

        For Each item As GridDataItem In myGridDental.Items
            Dim QuesId As Integer = myGridDental.Items(item.ItemIndex).GetDataKeyValue("intQuestionId")
            Dim data As TextBox = (TryCast(item.FindControl("txtData"), TextBox))
            Dim Remarks As TextBox = TryCast(item.FindControl("txtRemarks"), TextBox)
            Dim Dtdate As TextBox = TryCast(item.FindControl("txtCal"), TextBox)
            Dim answer As RadioButtonList = TryCast(item.FindControl("rblDental"), RadioButtonList)

            sql = "Insert tblSRpEventData (intPersonnelId, intSRPAttendId, intQuestionId, intAnswer, strData, strRemarks, strDocDate, dtLogged, strlogged) VALUES ('" & PersId & "',  " & AttendId & ", " _
                & "" & QuesId & ", " & answer.SelectedValue & " , '" & Replace(data.Text, "'", "") & "', '" & Replace(Remarks.Text, "'", "") & "', '" & Replace(Dtdate.Text, "'", "") & "', '" & Date.Today & "', " _
                & "'" & userlogon & "')"
           
            Try
                insertUpdateDelete(sql)
            Catch ex As Exception
                lblError.Text = ex.Message.ToString & " - ERROR Save Dental   <br> " & lblErrorMsg.Text
                SetFocus(aError)
            End Try
        Next

    End Sub

Iana Tsolova
Telerik team
 answered on 04 May 2011
1 answer
95 views
Hi Team,
               I'm using Telerik Grid. inside it i'm having CheckboxList in Edit Item Template. also i'm using RadGrid EditTemplate()function to populate the values to Drop down and Checkboxlist controls. these are the dynamic controls.

My Grid is showing the data in below format. The Available Location is Checkbox list control and Format is DropDownlist control. both are EdititemTemplate controls.         

Emp Id

Emp Name

Emp Type

Available Location

Format

1001

Alexis

Permanent

New York

$##,###,###.00

1002

Michel

Permanent

New Jersey

$##,##.00

1003

Erin Smith

Permanent

Philadelphia

$##,##

1004

Brown Liza

Temporary

Los Angels

Mmm/yyyy




The Expected Grid is attached here. and the Checkboxlist items status has to be maintain between postbacks. every time i'm updating the Grid values using the concept of Auto Save(http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx ) . and every time when i tried to save the grid line, it take me to RadGrid1_EditTemplate() function.


Please tell me how to taggle this situation.
Please reply ASAP.


Thanks
Alexis

Iana Tsolova
Telerik team
 answered on 04 May 2011
3 answers
1.0K+ views
Hi all, I am having trouble with the visible property of an  GridTemplateColumn.

I have an AutoGenerated EditType edit screen because of the dynamic nature of the requirement. I have added a necessary dropdown onto this edit area by adding an GridTemplateColumn to the <Columns> area of the radgrid.

I need this GridTemplateColumn to only be visible under certain circumstances but I have no luck. Setting the visible property = "false" in the tag itself does not work. Nor does setting the .Display, .ReadOnly or .Visible properties in the code behind. I have tried hooking into the column in both ItemDataBound and PreRender events. I have tried finding the column from the MasterTable and other methods as well.

Every time I find the column correctly (verified by debugging the UniqueName) but the column is always visible.

I tried adding a label inside the GridTemplateColumn and set EditFormHeaderTextFormat to an empty string but the column space is reserved and thus my label is indented.

A solution to either would solve this issue. Need some help please!

Thanks :)

EDIT - My column is of type EditItemTemplate so that it shows on the Edit Form. If I change it to ItemTemplate I am able to make the column Visible = false
Brad
Top achievements
Rank 1
 answered on 04 May 2011
1 answer
118 views
Hi ,
I was tring to select TreeListDataItem dynamically using the following code.

foreach (TreeListDataItem item in RadTreeList1.Items)
                {
                    if (value != null && value.Count > 0)
                    {
                        foreach (Facility facility in value.Facility)
                        {
                            if (item["Key"].Text == facility.Key)
                            {
                                item.Selected = true;
                                break;
                            }
                        }
                    }
                }

However what I found that the only the parent items can be selected.
I am not able to select any of the child or sub child items.
Please advice what the best way to select any child items if they need to be selected.

Thanks in advance.

Veli
Telerik team
 answered on 04 May 2011
3 answers
40 views
Hi.

I save 3 images in the folder and images name in the database. Like this i added 3 records. Here is my code

  foreach (UploadedFile f in RadUpload1.UploadedFiles)
            {
                string strfolder;
                dataquery dq = new dataquery();
                string strsql;
                strfolder = Server.MapPath("../noon");
                f.SaveAs(strfolder + "\\" + f.GetName(), true);
                strsql = "insert into images(imid,imagname) values('1','" + f.GetName() + "')";
                dq.ExecuteQuery(strsql);
            }
Now i want to update my record and images. but i do't know how to show images in the Radupload control or then i what to write code for update.

Please can you see my above code and help me to write update code and select record images in the Radupload. I am not using Radgrid.

Thank you so much for help.

 

 

 

 

 

 

 

Peter Filipov
Telerik team
 answered on 04 May 2011
3 answers
135 views
I added an image button to the title bar in code behind, everything works well but when hovering over the button I get the drag cursor and I can not click the image Button. This happen only in IE8 , in chrome it works perfectly ( I am able to click the image button).

Any ideas?      
Pero
Telerik team
 answered on 04 May 2011
1 answer
135 views
Failed to Load Viewstate Problem
Whenever, I try to upload with the RadAsyncUpload control I get the following error.

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.


Is there something I need to do to avoid this problem?
Peter Filipov
Telerik team
 answered on 04 May 2011
1 answer
350 views
I like this feature that limits the filtering options in the RadGrid based on the column's data type.

Is there a way to override which options are available for a particular data type?  (I'm manually implementing the web service data source for the grid, and I'm have not implemented all of them yet.)
Iana Tsolova
Telerik team
 answered on 04 May 2011
3 answers
1.4K+ views
I want to remove cell padding space in the telerik grid coloumn
Galin
Telerik team
 answered on 04 May 2011
1 answer
249 views
Hi Guys, 

I have a problem Im hoping you can help me with.  

I have a RadGrid, with a RadFilter on it.  The RadFilter button is an ItemCommand on the RadGrid.  I have since put another ItemCommand on to call a RadWindow to display my insert record aspx page.  

However I cant seem to get the ItemCommand to link to the Call Function

Here is the ASPX Code
<CommandItemTemplate>
                    <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick Skin="WebBlue">
                        <Items>
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid"
                            ImageUrl="~/Images/Refresh.gif"/>
                            <telerik:RadToolBarButton Text="Add new" CommandName="xInsert"
                            ImageUrl="~/Images/AddRecord.gif" />                 
                             
                        </Items>
                    </telerik:RadToolBar>
                     
                </CommandItemTemplate>


Here is my VB Code
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
        If e.CommandName = "FilterRadGrid" Then
            RadFilter1.FireApplyCommand()
        Else
            If e.CommandName = "xInsert" Then
                Dim newWindow As New Telerik.Web.UI.RadWindow()
                newWindow.ID = "InsertWindow"
                newWindow.NavigateUrl = "~/XDW/EditPalletQty.aspx"
                newWindow.VisibleOnPageLoad = True
                RadWindowManager1.Windows.Add(newWindow)
 
 
            End If
 
        End If
    End Sub

The filter works great however I cant seem to get the RadGrid to fire.  I have also tried calling the client side javascript from the VB code however that didnt fire either.

Any help is appriciated.

Cheers
Joel
Iana Tsolova
Telerik team
 answered on 04 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?