Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
53 views
Is there a way to limit client-side row selection to one row per grouping in a radgrid without causing a postback every time?

I used an old example (see below), but each click of a checkbox causes a postback which is disruptive to the process. I wasn't sure if there was some built in functionality or an easy way to check at the end if too many were selected.

Thank you..

<radG:GridTemplateColumn UniqueName="CheckBoxColumn">
 <ItemTemplate>
   <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckedChanged" />
 </ItemTemplate>
</radG:GridTemplateColumn>

public void CheckedChanged(object sender, EventArgs e)
    {
        GridDataItem checkedItem = (GridDataItem)(sender as CheckBox).NamingContainer;
        string checkedItemIndex = checkedItem.GroupIndex.Substring(checkedItem.GroupIndex.LastIndexOf('_'), 2);
 
        foreach (GridDataItem item in checkedItem.OwnerTableView.Items)
        {
            string currItemIndex = item.GroupIndex.Substring(item.GroupIndex.LastIndexOf('_'), 2);
 
            if (checkedItem.GroupIndex.StartsWith(item.GroupIndex.Substring(0,1)) && currItemIndex != checkedItemIndex)
            {               
                (item.FindControl("CheckBox1") as CheckBox).Checked = false;
            }
        }
    }
Tsvetina
Telerik team
 answered on 19 Jan 2012
2 answers
120 views
Hi,
I am getting the String was not recognized a a valid date time in radscheduler on clicking the date of month view.
I am using Telerik version 2010.1.519.40 dll in IE 8.I have attached screenshots
deepak
Top achievements
Rank 2
 answered on 19 Jan 2012
2 answers
61 views
Can we expect to see the same level of we service binding available for RadListView as we have with, say, RadGrid? -- Stuart
Stuart Hemming
Top achievements
Rank 2
 answered on 19 Jan 2012
1 answer
33 views
Hi,
    
    I am using Rad Scheduler Control. I want the time slots to be displayed as 7:00 am,15,30,45,8:00 am when i set MinutesPerRow to 15. And also I want to highlight the current time's row.
 Please tell how can I achieve this.

Thanks
Lokesh 
               
Peter
Telerik team
 answered on 19 Jan 2012
1 answer
317 views
hello,

 i want bind the listview on textbox change 

i mean when i type any word then listview bind data from my database and refresh on next world on textbox when i type

i am not get any help 
so please tell me some idea or code 

thanks
Princy
Top achievements
Rank 2
 answered on 19 Jan 2012
1 answer
66 views
I am using Telerik Rad Tree List. when expanding the tree , it is postback and get child data from server. it is ok. but when collapse the tree, the page is again reload.

i am not sure, it is default action in telerik tree list.

i am using vs2010 and sql server 2008 for my web application.

How to avoid the reloading while collapse the tree.

Thanks,
Uma
Shinu
Top achievements
Rank 2
 answered on 19 Jan 2012
2 answers
78 views
hi expert,

i am using the telerik rad grid in my projects can you please suggest the proper way for my problem

this is hierarchical grid(3 level) in the second and third level i use the "GridDropDownColumn" columns with my own datasource when i am in editing that row it show  the dorpdown when i change the drop down value in it the other column's values will be changed corresponding with some logic how can it possible and one more this i want to edit the multiple rows all the changes will be saved at final is it possible in this control. my code is  ,please look at the attached image also.

 &nbsp;<telerik:RadGrid ID="dgProduct" runat="server" AutoGenerateColumns="false" AllowAutomaticUpdates="true"
                                        AutoGenerateHierarchy="true" >
                                        <MasterTableView EditMode="InPlace" >
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="PKProductID" HeaderText="PKProductID" Visible="false"><HeaderStyle BackColor="BlanchedAlmond" /></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="SourceID" HeaderText="Style #" />
                                                <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" />
                                                <telerik:GridBoundColumn DataField="Language1SubTitle" HeaderText="Sub Title" />
                                                <telerik:GridDropDownColumn HeaderText="Clearance" UniqueName="StyleClearance" DataSourceID="SourceCheck"
                                                    ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="ClearanceItem" />
                                                <telerik:GridDropDownColumn HeaderText="Active" UniqueName="StyleActive" DataSourceID="SourceCheck"
                                                    ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                                <telerik:GridBoundColumn DataField="Price" HeaderText="Price" />
                                                <telerik:GridBoundColumn DataField="SalePrice" HeaderText="Sale Price" />
                                            </Columns>
                                            <DetailTables>
                                                <telerik:GridTableView DataMember="Colors" HierarchyLoadMode="ServerOnDemand" >
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="FKProductid" HeaderText="FKProductid" Visible="false" />
                                                        <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" ReadOnly="true" />
                                                         <telerik:GridBoundColumn DataField="PKGroupScaleItemID" HeaderText="Color Id" ReadOnly="true"  />
                                                           <telerik:GridDropDownColumn UniqueName="ColorSourceID" DataSourceID="SourceColors"
                                                            HeaderText="Colors" DataField="SourceID" SortExpression="ScaleLanguage1Name"
                                                            ListTextField="ScaleLanguage1Name" ListValueField="ScaleType" />
                                                        <telerik:GridDropDownColumn HeaderText="Active" UniqueName="ColorActive" DataSourceID="SourceCheck"
                                                            ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                                    </Columns>
                                                    <DetailTables>
                                                        <telerik:GridTableView DataMember="Sizes" HierarchyLoadMode="ServerOnDemand"  Width="300px" >
                                                            <Columns>
                                                                <telerik:GridBoundColumn DataField="FKProductid" HeaderText="FKProductid" Visible="false" />
                                                                <telerik:GridBoundColumn DataField="Language1Title" HeaderText="Title" ReadOnly="true"  />
                                                                <telerik:GridBoundColumn DataField="SourceID" HeaderText="Size ID" ReadOnly="true" />
                                                                <telerik:GridDropDownColumn UniqueName="SizeSourceID" DataSourceID="SourceSizes"
                                                                    HeaderText="Sizes" DataField="SourceID" SortExpression="ScaleLanguage1Name" ListTextField="ScaleLanguage1Name"
                                                                    ListValueField="PKGroupScaleItemID" />
                                                                <telerik:GridBoundColumn DataField="BackOrderDays" HeaderText="Back Order Days" />
                                                                <telerik:GridBoundColumn DataField="SKU" HeaderText="SKU" />
                                                                <telerik:GridBoundColumn DataField="QuantityAvailable" HeaderText="Quantity" />
                                                                <telerik:GridDropDownColumn HeaderText="Active" UniqueName="SizeActive" DataSourceID="SourceCheck"
                                                                    ListTextField="Text" ListValueField="Text" SortExpression="Text" DataField="Active" />
                                                            </Columns>
                                                        </telerik:GridTableView>
                                                    </DetailTables>
                                                </telerik:GridTableView>
                                            </DetailTables>
                                            <EditFormSettings>
                                                <EditColumn Reorderable="false" Resizable="false" />
                                            </EditFormSettings>
                                        </MasterTableView>
                                        <ClientSettings>
                                            <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" />
                                            <ClientEvents OnColumnMouseOut=" />
                                        </ClientSettings>
                                    </telerik:RadGrid>
koteswararao
Top achievements
Rank 1
 answered on 19 Jan 2012
4 answers
122 views

I have a databound grid and am needing to add an additional column that will show a link to a google map for the location designated for the record in each row.

firstly im not sure i am doing this in the correct place, second issue im having (using hard coded parameters) is that the URL is not including these parameter values, the URL just shows the querystring names but none of these has the additional values.

as far as i can see the url format string seems correct and the urlparameters variable is getting the string values set ok, but for some reason they are not replacing the palceholder values in the url.

finally how would i get at the actual datatable values i need once i have this hard coded version working correctly?

heres my code:

Private Sub FillGrid()
        Try

            Dim gc As GridBoundColumn
            Dim glc As GridHyperLinkColumn           

            glc = New GridHyperLinkColumn
            Me.uxGrid.Columns.Add(glc)
            glc.HeaderText = "Map"
            Dim urlparameters As String()           
            urlparameters = New String() {"b12jp", "1234", "32.54545", "-2.2342342"}
            glc.DataNavigateUrlFields = urlparameters
            glc.DataTextFormatString = "{2:D}"
            glc.DataTextFormatString = "{3:D}"
            glc.DataNavigateUrlFormatString = "GoogleMaps.htm?postcode={0}&id={1}&lat={2}&lng={3}"
            glc.UniqueName = ""
            glc.ItemStyle.HorizontalAlign = HorizontalAlign.Center
            glc.Text = "Map"
            glc.HeaderStyle.Width = Unit.Pixel(40)
            glc.HeaderStyle.HorizontalAlign = HorizontalAlign.Center

            For Each col As DataColumn In _myData.Columns

                gc = New GridBoundColumn
                Me.uxGrid.Columns.Add(gc)
                gc.HeaderText = GetCaption(col.ColumnName)
                gc.UniqueName = col.ColumnName
                gc.DataField = col.ColumnName
                gc.Display = True
                gc.HeaderStyle.Width = Unit.Pixel(170)
                gc.ItemStyle.Wrap = True
            Next
           
        Catch ex As Exception
           
        End Try
    End Sub

Shinu
Top achievements
Rank 2
 answered on 19 Jan 2012
2 answers
186 views
Hi,

I'm trying to figure out how I can access the controls on a footer row outside the ItemDataBound event.

Objective:
I have a drop down list that has a OnSelected event. When the selection changes it needs to enable/disable controls that are in the footer row.

How can I accomplish this?
Shinu
Top achievements
Rank 2
 answered on 19 Jan 2012
0 answers
129 views
Hi,
I have created one usercontrol in Visual studio it contains Employee data here i performed Add,Delete,update,actions and i loaded this usercontrol in sharepoint site but i want to show toolbar for this form which contains Save,Edit like default sharepoint custom list how can i do for this.
here am sending my code please look at once

        protected void bt_add_Click1(object sender, EventArgs e)

        {

            Label6.Text = string.Empty;

            AddtoList();

            Label6.Visible = true;

        }

    

     

        protected void bt_view_Click(object sender, EventArgs e)

        {

            Gridview();

          

 

        }

        protected void bt_update_Click(object sender, EventArgs e)

        {

            Update();

            clear();

 

        }

        protected void btn_reset_Click(object sender, EventArgs e)

        {

            clearcontrols();

            Label6.Text = string.Empty;

           

        }

        protected void bt_delete_Click(object sender, EventArgs e)

        {

            Delete();

            txt_Item.Text = string.Empty;

        }

        protected void StuList_Grid_PageIndexChanged(object sender, GridPageChangedEventArgs e)

        {

            StuList_Grid.CurrentPageIndex = e.NewPageIndex;

            StuList_Grid.Visible = true;

            SPList taskList = SpListitems();

            DataTable tablelist = taskList.Items.GetDataTable();

            StuList_Grid.DataSource = tablelist;

            StuList_Grid.DataBind();

 

        }

        protected void Page_Load(object sender, EventArgs e)

        {

 

        }

      

        #endregion

        #region Methods

        //This method will display the sharepoint list items to Grid and

        //Show listitems in textboxes by id.

        private void Gridview()

        {

 

            if (txt_Item.Text == string.Empty)

            {

                try

                {

                    StuList_Grid.Visible = true;

                    Descending();

                    StuList_Grid.CurrentPageIndex = 0;

                    SPList taskList = SpListitems();

                    DataTable tablelist = taskList.Items.GetDataTable();

                    StuList_Grid.DataSource = tablelist;

                    StuList_Grid.DataBind();

                    Label6.Text = string.Empty;

                }

                catch (Exception ex)

                {

                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),

                    "AlertScript", "(function(){var f = function(){alert('not viewed', 370,210);Sys.Application.remove_load(f) ;};Sys.Application.add_load(f) ;})();", true);

 

                }

            }

            else

            {

                 StuList_Grid.Visible = false;

                    SPList taskList = SpListitems();

                    int id = Convert.ToInt32(txt_Item.Text);

                    SPListItem item = null;

                    try

                    {

                     

                        item = taskList.GetItemById(id);

                    }

                    catch (Exception ex)

                    {

                        Label6.Text = "Item doesnot Exist";

                    

                    }

                    if (item != null)

                    {

                        if (item["StuName"] != null)

                        {

                            txt_name.Text = item["StuName"].ToString();

                        }

                        else

                            txt_name.Text = string.Empty;

                        if (item["Department"] != null)

                        {

                            txt_dept.Text = item["Department"].ToString();

                        }

                        else

                            txt_dept.Text = string.Empty;

                        if (item["Location"] != null)

                        {

                            txt_location.Text = item["Location"].ToString();

                        }

                        else

                            txt_location.Text = string.Empty;

                        if (item["ContactNumber"] != null)

                        {

                            txt_number.Text = item["ContactNumber"].ToString();

                        }

                        else

                            txt_number.Text = string.Empty;

                        Label6.Text = string.Empty;

                    }

           

            }

           

            }

 

        //This will add textbox values to sharepoint list.

        private void AddtoList()

        {

            try

            {

                SPList taskList = SpListitems();

                SPListItem listitem = taskList.Items.Add();

                listitem["StuName"] = txt_name.Text;

                listitem["Department"] = txt_dept.Text;

                listitem["Location"] = txt_location.Text;

                listitem["ContactNumber"] = txt_number.Text;

                listitem.Update();

                Label6.Text  = "Records Saved";

                clearcontrols();

                Descending();

                grid();

 

            }

            catch (Exception ex)

            {

                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),

                "AlertScript", "(function(){var f = function(){alert('not inserted', 370,210);Sys.Application.remove_load(f) ;};Sys.Application.add_load(f) ;})();", true);

 

 

            }

        }

 

      

        //This will update the list items by id

        private void Update()

        {

            try

            {

                if (txt_Item.Text == string.Empty)

                {

                    Label6.Text = "ID value is Required";

                  

                }

              

                SPList taskList = SpListitems();

 

                SPListItem item = null;

                int id = Convert.ToInt32(txt_Item.Text);

                try

                {

                    item = taskList.GetItemById(id);

                }

                catch (Exception ex)

                {

                    Label6.Text = "Item doesnot Exist";

                   

                }

                if (item != null)

                {

                    item["StuName"] = txt_name.Text;

                    item["Department"] = txt_dept.Text;

                    item["Location"] = txt_location.Text;

                    item["ContactNumber"] = txt_number.Text;

                    item.Update();

                    taskList.Update();

                    Label6.Text = "Updated";

                    grid();

                }

              

            }

 

            catch (Exception ex)

            {

 

                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),

                "AlertScript", "(function(){var f = function(){alert('Not Updated', 370,210);Sys.Application.remove_load(f) ;};Sys.Application.add_load(f) ;})();", true);

 

            }

 

        }

        //This will delete the list items by id

        private void Delete()

        {

            try

            {

                if (txt_Item.Text == string.Empty)

                {

                    Label6.Text = "ID value is Required";

                   

                }

                else

                {

                    SPList taskList = SpListitems();

 

                    SPListItem item = null;

                    int id = Convert.ToInt32(txt_Item.Text);

                    try

                    {

                        item = taskList.GetItemById(id);

                    }

                    catch (Exception ex)

                    {

                        Label6.Text = "Item Doesnot Exist";

                      

                    }

                    if (item != null)

                    {

                        item["StuName"] = txt_name.Text;

                        item["Department"] = txt_dept.Text;

                        item["Location"] = txt_location.Text;

                        item["ContactNumber"] = txt_number.Text;

                        item.Delete();

                        Label6.Text = "Deleted";

                        grid();

                    }

                }

 

            }

 

            catch (Exception ex)

            {

 

                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),

                "AlertScript", "(function(){var f = function(){alert('Not Deleted', 370,210);Sys.Application.remove_load(f) ;};Sys.Application.add_load(f) ;})();", true);

 

            }

 

        }

      

        //This will return value from method

        protected SPList SpListitems()

        {

            string strDashListRoot = "http://dev02:2000";

            SPSite osite = new SPSite(strDashListRoot);

            SPWeb oWeb = osite.OpenWeb();

            oWeb.AllowUnsafeUpdates = true;

            SPList taskList = oWeb.Lists["Name"];

            return taskList;

        }

       

        //This clear all textboxes and grid

        private void clearcontrols()

        {

            txt_name.Text = string.Empty;

            txt_dept.Text = string.Empty;

            txt_location.Text = string.Empty;

            txt_number.Text = string.Empty;

            txt_Item.Text = string.Empty;

            StuList_Grid.Visible = false;

        }

       

        //This clear all textboxes

        private void clear()

        {

            txt_name.Text = string.Empty;

            txt_dept.Text = string.Empty;

            txt_location.Text = string.Empty;

            txt_number.Text = string.Empty;

            txt_Item.Text = string.Empty;

        }

       

        //This to bind  the grid

        private void grid()

        {

            

            StuList_Grid.Visible = true;

            SPList taskList = SpListitems();

            StuList_Grid.CurrentPageIndex = 0;

            //StuList_Grid.CurrentPageIndex = StuList_Grid.PageCount - 1;

            DataTable tablelist = taskList.Items.GetDataTable();

            StuList_Grid.DataSource = tablelist;

            StuList_Grid.DataBind();

 

        }

       

        //This will display latest item first in grid id in descending order

        private void Descending()

        {

            GridSortExpression expression = new GridSortExpression();

            expression.FieldName = "ID";

            expression.SortOrder = GridSortOrder.Descending;

            StuList_Grid.MasterTableView.SortExpressions.AddSortExpression(expression);

        }

 

        #endregion

    }

}

 



Thanks&Regards
P.Durga
Abu
Top achievements
Rank 1
 asked on 19 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?