Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
115 views
Hello Folks,

Can anyone tell that if it possible to set some Telerik's components property in ASP.INET Application wide?
For example: I have RadTextBoxes in my Application and when setting their ReadOnly property to false I would rather
want text to appear black than grey.

Where can I chage this kind of settings?

Cheers,

Mike
Top achievements
Rank 1
 answered on 14 Sep 2009
2 answers
98 views
Hello,
I have two comboboxes. The second one is filled from the selection of the first.
But if I select a value in the 2nd combobox and click on somewhere else in the screen the value at the first place gets displayed other then the selected value.

Please help me to solve this problem.

Regards,
Bhushan
Top achievements
Rank 1
 answered on 14 Sep 2009
1 answer
119 views

Here is the following Code

<radG:RadGrid ID="RadGrid1" Skin="Lime" runat="server" CssClass="RadGrid" GridLines="None"  AllowPaging="True" PageSize="5" AllowSorting="True" Width="99%" AutoGenerateColumns="False" EnableAJAX="True" ShowStatusBar="true" HorizontalAlign="NotSet" Source="RadGrid1_NeedDataSource"            OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand"

OnDeleteCommand="RadGrid1_DeleteCommand">

<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

<MasterTableView CommandItemDisplay="Top" GridLines="None" DataKeyNames="CustomerID"

EditMode="InPlace">

<Columns>

<radG:GridEditCommandColumn>

</radG:GridEditCommandColumn>

<radG:GridBoundColumn UniqueName="CustomerID" HeaderText="ID" ReadOnly="true" DataField="CustomerID">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="CompanyName" HeaderText="CompanyName" DataField="CompanyName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="ContactName" HeaderText="ContactName" DataField="ContactName">

</radG:GridBoundColumn>

<radG:GridBoundColumn UniqueName="Address" HeaderText="Address" DataField="Address">

</radG:GridBoundColumn>

<radG:GridButtonColumn CommandName="Delete" Text="Delete">

</radG:GridButtonColumn>

</Columns>

<EditFormSettings EditFormType="Template">

<EditColumn UniqueName="EditCommandColumn1">

</EditColumn>

<FormTemplate>

<table id="Table2" cellspacing="2" cellpadding="1" width="250" border="1" rules="none"

style="border-collapse: collapse">

<tr>

<td>

<table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0">

<tr>

<td>

</td>

<td>

</td>

</tr>

<tr>

<td>

CustomerID:

</td>

<td>

<asp:TextBox ID="txtCustomerID" MaxLength="5" Visible='<% # (Container as GridItem).OwnerTableView.IsItemInserted %>'

runat="server">

</asp:TextBox>

</td>

</tr>

<tr>

<td>

CompanyName:

</td>

<td>

<asp:TextBox ID="txtCompanyName" runat="server" Text='<%# Eval( "CompanyName" ) %>'>

</asp:TextBox>

</td>

</tr>

<tr>

<td>

ContactName:

</td>

<td>

<asp:TextBox ID="txtContactName" runat="server" Text='<%# Eval( "ContactName") %>'

TabIndex="1">

</asp:TextBox>

</td>

</tr>

<tr>

<td>

Address:

</td>

<td>

<asp:TextBox ID="txtAddress" runat="server" Text='<%# Eval( "Address") %>' TabIndex="2">

</asp:TextBox>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td colspan="2">

<b>Company Info:</b>

</td>

</tr>

<tr>

<td align="right" colspan="2">

<asp:Button ID="btnUpdate" Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>'

runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>'>

</asp:Button>&nbsp;

<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"

CommandName="Cancel"></asp:Button>

</td>

</tr>

</table>

</FormTemplate>

</EditFormSettings>

<ExpandCollapseColumn Visible="False">

<HeaderStyle Width="19px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</MasterTableView>

</radG:RadGrid>

 

Code Behined:-

//Declare a global DataTable dtTable

public static DataTable dtTable;

//Declare a global SqlConnection SqlConnection

//public SqlConnection SqlConnection = new SqlConnection("Data Source=local;Initial Catalog=Northwind;User ID=**");

public SqlConnection SqlConnection = new SqlConnection("Data Source=(local);Initial Catalog=Northwind;uid=sa;pwd=password;");

//Declare a global SqlDataAdapter SqlDataAdapter

public SqlDataAdapter SqlDataAdapter = new SqlDataAdapter();

//Declare a global SqlCommand SqlCommand

public SqlCommand SqlCommand = new SqlCommand();

   

 protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

    {

//Populate the Radgrid

dtTable = new DataTable();

//Open the SqlConnection

SqlConnection.Open();

try

{

//Select Query to populate the RadGrid with data from table Customers.

string selectQuery = "SELECT CustomerID,CompanyName,ContactName,Address FROM Customers";

SqlDataAdapter.SelectCommand = new SqlCommand(selectQuery, SqlConnection);

SqlDataAdapter.Fill(dtTable);

RadGrid1.DataSource = dtTable;

}

finally

{

//Close the SqlConnection

SqlConnection.Close();

}

       

     

    }

 protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)

    {

        //Get the GridEditableItem of the RadGrid

GridEditableItem editedItem = e.Item as GridEditableItem;

//Get the primary key value using the DataKeyValue.

string CustomerID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["CustomerID"].ToString();

//Access the textbox from the edit form template and store the values in string variables.

string CompanyName= (editedItem.FindControl("txtCompanyName") as TextBox).Text;

string ContactName = (editedItem.FindControl("txtContactName") as TextBox).Text;

string Address = (editedItem.FindControl("txtAddress") as TextBox).Text;

 

try

{

//Open the SqlConnection

SqlConnection.Open();

//Update Query to update the Datatable

string updateQuery = "UPDATE Customers set CompanyName='"+CompanyName+"',ContactName='"+ContactName+"',Address='"+Address+"' where CustomerID='" + CustomerID+"'";

SqlCommand.CommandText = updateQuery;

SqlCommand.Connection = SqlConnection;

SqlCommand.ExecuteNonQuery();

//Close the SqlConnection

SqlConnection.Close();

}

catch (Exception ex)

{

RadGrid1.Controls.Add(new LiteralControl("Unable to update Customers. Reason: " + ex.Message));

e.Canceled = true;

}

    }

 protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)

    {

//Get the GridEditFormInsertItem of the RadGrid

 

GridDataInsertItem insertedItem = (GridDataInsertItem)e.Item;

//GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;

 

 

 

//Access the textbox from the insert form template and store the values in string variables.

string CustomerID = (insertedItem.FindControl("txtCustomerID") as TextBox).Text;

string CompanyName = (insertedItem.FindControl("txtCompanyName") as TextBox).Text;

string ContactName = (insertedItem.FindControl("txtContactName") as TextBox).Text;

string Address = (insertedItem.FindControl("txtAddress") as TextBox).Text;

 

try

{

//Open the SqlConnection

SqlConnection.Open();

//Update Query to insert into  the database

string insertQuery = "INSERT into  Customers(CustomerID,CompanyName,ContactName,Address) values('"+CustomerID+"','"+ CompanyName + "','"+ContactName+"','"+Address+"')";

SqlCommand.CommandText = insertQuery;

SqlCommand.Connection = SqlConnection;

SqlCommand.ExecuteNonQuery();

//Close the SqlConnection

SqlConnection.Close();

}

catch (Exception ex)

{

RadGrid1.Controls.Add(new LiteralControl("Unable to insert Customers. Reason: " + ex.Message));

e.Canceled = true;

}

   

    }

protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)

    {

//Get the GridDataItem of the RadGrid

GridDataItem item = (GridDataItem)e.Item;

//Get the primary key value using the DataKeyValue.

string CustomerID = item.OwnerTableView.DataKeyValues[item.ItemIndex]["CustomerID"].ToString();

try

{

//Open the SqlConnection

SqlConnection.Open();

string deleteQuery = "DELETE from Customers where CustomerID='" + CustomerID + "'";

SqlCommand.CommandText = deleteQuery;

SqlCommand.Connection = SqlConnection;

SqlCommand.ExecuteNonQuery();

//Close the SqlConnection

SqlConnection.Close();

}

catch (Exception ex)

{

RadGrid1.Controls.Add(new LiteralControl("Unable to delete Customers. Reason: " + ex.Message));

e.Canceled = true;

}

    }

 

But I am not able to either Insert/Update Records.

Please Help me in this regards.

I want to Insert/Update Records only in In-Place Mode.

 

At the same time I want to Bind the Combo Box(Which is Grid) from Other table recors.

Please Guide me…..

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yavor
Telerik team
 answered on 14 Sep 2009
1 answer
137 views
Hi,

I would like to submit a code example. What files are required and where do I send/post it?

Thanks.

Princy
Top achievements
Rank 2
 answered on 14 Sep 2009
1 answer
120 views
Hi,

I have grid with tabstrip. I use NestedViewTemplate for that. I want when the user click add new button have to show tabstrip to add new record. Now tabstrip show only expand button.  This is my existing code

  <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                      <telerik:radtabstrip ID="RadTabStrip1" runat="server" SelectedIndex="0" AutoPostBack="true"
     

How can i show this tabstrip , when the user click add new link?

lakmal
Shinu
Top achievements
Rank 2
 answered on 14 Sep 2009
3 answers
260 views
Hi,

I am using a GridClientSelectColumn and have a paging on my grid. I need following things on my grid.

1) Multiple selection client-side
2) If i do select all from the header checkbox on page1, it should also select the rows at all other pages.
3) Deselect should deselect only the single row, not all.
4) If i select a single row on page1, and move on to any other page and now when i come back to page1 the row should persist its state.

I would appreciate any help on this.

Thanks,
Sunil Nahar.
Yavor
Telerik team
 answered on 14 Sep 2009
1 answer
199 views
hi,

i am a newbie to telerik and ajax, i am trying to show a popup image on move hover for an grid item.
i have found a similar article which says i an use that a itemtemplate and show a popup.

 <telerik:GridTemplateColumn UniqueName="TemplateCol" HeaderText="TemplateCol"
                            <ItemTemplate> 
                                <asp:Label id="lblName" runat="server" Text='<%#Eval("ProductName") %>' ></asp:Label> 
 
                               
                                <asp:Panel ID="popupMenu" runat="server" style="display:none" BackColor="skyblue" > 
                                    <asp:Button  ID="btnCopy" runat="server"></asp:Button> 
                                   
                                </asp:Panel> 
                                 <cc1:HoverMenuExtender ID="HoverMenuExtender1" TargetControlID="lblName" runat="server" 
                                    PopupControlID="popupMenu" PopupPosition="right" PopDelay="50"
                                </cc1:HoverMenuExtender> 
                                
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 


the problem i am facing here is to include the assembly with the tag name "cc1" which has the "HoverMenuExtender" method, i think this is from the ajax control library.

also let me know if it is possible to catch the click event of the button "btnCopy" on the server side ( and)  is still need to be able to tell on which cell the click event was raised.
i am stuck with this problem for more than 2 days, so, please help me out.

thank you.


 
Princy
Top achievements
Rank 2
 answered on 14 Sep 2009
0 answers
89 views
I'm trying to implement a tabstrip with multipage. My page views are dynamically loaded user controls.

This is basically how the flow works.
 
I have a RADgrid (named RadGrid1) that contains a number of columns. When you click on a row in the grid, a tab is created that represents the data of that gridrow. To accompish this I use "RadGrid1_ItemCommand" and check for the "RowClick" command. I then get the name of the column I need and use that to name the tab. Here's the C# code to add the new tab and its coressponding page view.

private

 

void AddTab(string tabName)

 

{

 

    RadTab tab = new RadTab();

 

    tab.Text = tabName;

    RadTabStrip.SelectedIndex = selectedTabIndex;

    RadTabStrip.Tabs.Add(tab);

 


    RadPageView
pageView = new RadPageView();

 

    pageView.ID = tabName;

    RadMultiPage.SelectedIndex = selectedTabIndex;

    RadMultiPage.PageViews.Add(pageView);

}


protected

 

void RadMultiPage_PageViewCreated(object sender, RadMultiPageEventArgs e)

 

{

 

    string userControlName = "UserControls/VMDetails.ascx";

 

 

    Control userControl = LoadControl(userControlName, passName, passIP);

 

    userControl.ID = passName +

"_vmdtl";

 

    e.PageView.Controls.Add(userControl);

}


The problem I'm having is that the first two tabs are created fine, but the thrid tab doesn't get created because I get an error on the page indicating the userControl.ID is a dupicate. Trying to debug this issue I noticed that the code doesn't follow the design I think it should follow.

When I click on a row, I would think the first code execution would be in the "RadGrid1_ItemCommand" method to see if the the "RowClick" command is true, however this is not the case. The first execution appears to be the "RadMultiPage_PageViewCreated" method. If you look at the code above, the "passName" value during the execution the third time has a value from the previous tab creation and therefor the userControl.ID is the same.

Why does execution go directly to "RadMultiPage_PageViewCreated'? Any Thoughts?

Thanks!





Shawn Currie
Top achievements
Rank 1
 asked on 14 Sep 2009
5 answers
184 views
I see the discussions on Batch Updates with RadGrid.  I intend on trying it out, but I was wondering how to do something similar with Add/Inserts?
Phil H.
Top achievements
Rank 2
 answered on 13 Sep 2009
2 answers
96 views
I am getting a "The specified value cannot be set on pagesize" error when trying to change the page size with the "NextPrevNumericAndAdvanced" pager while using a custom control edit form.

The line that seems to be causing the error is:
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

In the beginning of the function:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
        {  
            GridEditableItem editedItem = e.Item as GridEditableItem;  
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);  
 
            switch (e.CommandName)  
            {  
                case "PerformInsert": 

If I Comment this line out ( incuding references to userControl )  setting the page size works.

I am using the newest version 2009.2.906.20

The grid is in a UserControl that I am dynamically adding to the page but I do not have any problems with any other functionality.

Any Ideas on what might be causing this?

Thanks in advance,
Dave
Dave Miller
Top achievements
Rank 2
 answered on 12 Sep 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?