Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
97 views
Hello,

I have a problem to retrieve data in insert mode. It works fine in Update mode ...

<telerik:RadGrid ID="RadGridNomenclature" EnableViewState="true" OnItemCommand="RadGridNomenclature_ItemCommand" OnItemDataBound="RadGridNomenclature_ItemDataBound" OnUnload="RadGridNomenclature_Unload" OnNeedDataSource="RadGridNomenclature_NeedDataSource" OnInsertCommand="RadGridNomenclature_InsertCommand" OnDeleteCommand="RadGridNomenclature_DeleteCommand" OnUpdateCommand="RadGridNomenclature_UpdateCommand" runat="server" Skin="Windows7" PageSize="20" Width="777px">
    <MasterTableView AllowAutomaticInserts="true" AutoGenerateColumns="false" DataKeyNames="uid" InsertItemPageIndexAction="ShowItemOnCurrentPage" AllowPaging="True" CommandItemDisplay="Top">
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                <ItemStyle CssClass="MyImageButton" />
            </telerik:GridEditCommandColumn>
 
            <telerik:GridTemplateColumn HeaderText="UID" SortExpression="uid" UniqueName="uid" Visible="True">
                <HeaderStyle Width="175px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="uid" Text='<%# Eval("uid") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox ID="RadTextBoxUid" runat="server" Text='Calculated by the system' Width="175px" ReadOnly="True" Enabled="false" />
                </InsertItemTemplate>
                <EditItemTemplate>
                   <telerik:RadTextBox ID="RadTextBoxUid" runat="server" Text='<%# Bind("uid") %>' Width="175px" ReadOnly="True" />
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn HeaderText="Description" SortExpression="description" UniqueName="description" Visible="True">
                <HeaderStyle Width="500px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="description" Text='<%# Eval("description") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox ID="RadTextBoxDescription" runat="server" Width="450px" />
                </InsertItemTemplate>
                <EditItemTemplate>
                   <telerik:RadTextBox ID="RadTextBoxDescription" runat="server" Text='<%# Bind("description") %>' Width="450px" />
                </EditItemTemplate>               
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn HeaderText="ISO country code" SortExpression="c" UniqueName="c" Visible="False">
                <HeaderStyle Width="75px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="c" Text='<%# Eval("c") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox ID="RadTextBoxC" runat="server" Width="100px"/>
                </InsertItemTemplate>
                <EditItemTemplate>
                   <telerik:RadTextBox ID="RadTextBoxC" runat="server" Text='<%# Bind("c") %>' Width="100px" />
                </EditItemTemplate>               
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn HeaderText="Identifiant telephonique" SortExpression="code" UniqueName="code" Visible="False">
                <HeaderStyle Width="75px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="code" Text='<%# Eval("code") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox ID="RadTextBoxCode" runat="server" Width="100px"/>
                </InsertItemTemplate>
                <EditItemTemplate>
                   <telerik:RadTextBox ID="RadTextBoxCode" runat="server" Text='<%# Bind("code") %>' Width="100px" />
                </EditItemTemplate>               
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn HeaderText="Nationality" SortExpression="nationality" UniqueName="nationality" Visible="False">
                <HeaderStyle Width="175px" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="nationality" Text='<%# Eval("nationality") %>'></asp:Label>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox ID="RadTextBoxNationality" runat="server" Width="210px"/>
                </InsertItemTemplate>
                <EditItemTemplate>
                   <telerik:RadTextBox ID="RadTextBoxNationality" runat="server" Text='<%# Bind("nationality") %>' Width="210px" />
                </EditItemTemplate>               
            </telerik:GridTemplateColumn>
 
            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ConfirmDialogWidth="220px">
                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridButtonColumn>
        </Columns>
        <EditFormSettings CaptionDataField="Description">
            <EditColumn ButtonType="ImageButton" />
            <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow" />
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

Here is the UpdateCommand function :

protected void RadGridNomenclature_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item = e.Item as GridEditableItem;
 
            Hashtable newValues = new Hashtable();
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, item);
             
            [...]
        }

I can retrieve key and values in the newValues Hashtable.

The same code for the insert commande return me an empty newValues Hashtable.

protected void RadGridNomenclature_InsertCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
 
    Hashtable newValues = new Hashtable();
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, item);
 
    String desc = newValues["description"].ToString();  // ---------- newValues is Empty ---------------
}

Have you any ideas ?

Regards,
Shinu
Top achievements
Rank 2
 answered on 28 Nov 2011
2 answers
74 views
Hi Telerik Team,

Is there a way to fire the HeaderContextMenu of a RadGrid based on button click instead of Header right click?
I want to place a button in the header of the grid, once clicked it should open the HeaderContextMenu.

Please do let me know how can I achieve such scenario.

Thanks,
Bilal
Antonio Stoilkov
Telerik team
 answered on 28 Nov 2011
1 answer
39 views

Hi,

I have a telerik  RadTreelist in Asp.net web page.
Treelist have 5 columns.I have set width of each column.
Total with of the Treelist is same as the page width.
My problem is when I expand nodes in a treelist
Width of the treelist expanded and out side the page width.
My requirement is  when expanding nodes
in  treelist ,the  width  of the  treelist should be set to fit the page width.
How can achieve this?
Princy
Top achievements
Rank 2
 answered on 28 Nov 2011
1 answer
70 views
Hi,

I'm using a RadGrid,Where I added a CheckBox column as <GridTemplateColumn><itemTemplate><asp:CheckBox>.Which is Dynamically created for all items of the RadGrid. But while page index has changed and getting back to the old page...The checkbox status hadn't retaining.

If anyone had any solution,Please reply to the post as soon as possible.

Regards,
Anil Kumar.
Shinu
Top achievements
Rank 2
 answered on 28 Nov 2011
1 answer
159 views
I have a grid in which I display column totals in the footer.
Below is the declaration of my grid column.
<telerik:GridTemplateColumn UniqueName="EndBalance" HeaderText="Ending Balance" ItemStyle-HorizontalAlign="Right"
                                FooterStyle-HorizontalAlign="Right">
                                <ItemTemplate>
                                    <asp:HyperLink ID="linkEndBalance" runat="server" Text='<%# Eval("EndBalanceDollars")%>'></asp:HyperLink>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:HyperLink ID="linkEndBalanceTotal" runat="server"></asp:HyperLink>
                                    <br />
                                    <asp:HyperLink ID="linkEndBalanceGrandTotal" runat="server"></asp:HyperLink>
                                </FooterTemplate>
                            </telerik:GridTemplateColumn>

I am having troubles with the footer when exporting the grid.
The total and the grand total columns overlap each other and are not displayed on separate lines.

I have my exportonlydata set to true.

How can I get the line break in the footer.
Shinu
Top achievements
Rank 2
 answered on 28 Nov 2011
1 answer
60 views
I am hiding the add new button and the refresh button and only displaying the export buttons in the commanditemdisplay.
However, I see a line next to the export buttons and I am not sure how to get rid of that.

Below is attached screenshot showing the line. I have highlighted the line in red.
Shinu
Top achievements
Rank 2
 answered on 28 Nov 2011
1 answer
265 views
Error : Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: Rebind.

In one of our project requirement we have customized the SPRADGRID webpart and have created our own webpart. We are facing some issues with Ajax request. 

The rad grid is bound to an SharePoint list. and we are calling the ShowEditInsertForm to open the Edit And Add form for the list. when we submit the form. We are trying to refresh the grid through ajax request when the model pop is closed. we get the above mentioned error when the ajax request completes its execution.




below is some part from the code.

Ajax Manager ajax request code
      void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "Rebind")
            {
                this.Grid.Rebind();
            } 
        }


JavaScript Code to raise the request
function refreshGrid(arg)
{
    if (!arg)
    {
        ajaxManagerClientId = 'ctl00_RadAjaxManager1';
        $find(ajaxManagerClientId).ajaxRequest();
    }
    else
   {
        ajaxManagerClientId = 'ctl00_RadAjaxManager1';
        $find(ajaxManagerClientId).ajaxRequest();
    }
}


Vikas Kamble
Top achievements
Rank 1
 answered on 27 Nov 2011
3 answers
179 views
Hello ,,

I've two RadComboBox one for the Region and the other for the Place,,

                <telerik:RadComboBox ID="ddl_Regions" runat="server" Skin="WebBlue" Filter="Contains" 
                    Width="200px" AutoPostBack="True" CssClass="Lists">  
                </telerik:RadComboBox> 
 
                <telerik:RadComboBox ID="ddl_Places" runat="server" Skin="WebBlue" Filter="Contains" 
                    Width="200px" CssClass="Lists">  
                </telerik:RadComboBox> 

When the user choose a Region the Place list will rebind and get the Places of  the selected Region

                    Dim Places As New BusinessLayer.Placess  
                    Places.GetByRegionID(ddl_Regions.SelectedValue)  
                    ddl_Places.DataSource = Places  
                    ddl_Places.DataTextField = "Name" 
                    ddl_Places.DataValueField = "ID" 
                    ddl_Places.DataBind()  
 

everything was fine until i put the Region

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="ddl_Regions" /> 
                <telerik:AjaxUpdatedControl ControlID="ddl_Places" /> 
                <telerik:AjaxUpdatedControl ControlID="lbl_result" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 

when I did that the application still enter the selectedIndexChanged Event of the ddl_Regions and rebind the places but the ddl_Places does't refresh until i did a postback

Should i do postback everytime i want to rebind the ddl_Places data ,?,,  what's the best way to achieve this?

Thank for help
Vignesh
Top achievements
Rank 1
 answered on 26 Nov 2011
1 answer
81 views
I'm interested in building a tab strip that will dynamically change based on a value passed in a querystring, such as a date.
The current date will be highlighted in the tab and multiple days on either side of the center tab will show.
I've attached a screen shot of what I'd like to do and I didn't know if there's a similar example out there.

Thanks,
Matt
Matt
Top achievements
Rank 1
 answered on 25 Nov 2011
3 answers
151 views
Im facing a problem with encoding of RadComboBox.


Before postback in Viewstate I have: 


 
  ctl00_plhBody_ctrRegistration_cbBoss_ClientState:{"logEntries":[],"value":"20","text":"Андреев","enabled":true}



And after postback there is:


 
  {"logEntries":[],"value":"20","text":"&#1040;&#1085;&#1076;&#1088;&#1077;&#1077;&#1074;","enabled":true}<br>


And then application crashes. Its in updatePanel, and unfortunately I dont have error message (its on productioin right now and Ive got limited access to logs).


Thanks for any suggestions
Simon
Telerik team
 answered on 25 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?