Showing posts with label AspxGridView. Show all posts
Showing posts with label AspxGridView. Show all posts

Wednesday, 9 October 2013

How to resolve "The+input+is+not+a+valid+Base-64+string+as+it+contains+a+non-base+64+character%2c+more+than+two+padding+characters%2c+or+a+non-white+space+character+among+the+padding+characters"

I am getting the following exception after performing AspxCallbackPanel  Callaback. I have one "ASPxPanel" control inside the AspxCallbackPanel  control. I am adding devexpress "WebChartControl" control to the "ASPxPanel" control during the AspxCallbackPanel  callback at runtime.

Issue:
===

?DXCallbackErrorMessage=The+input+is+not+a+valid+Base-64+string+as+it+contains+a+non-base+64+character%2c+more+than+two+padding+characters%2c+or+a+non-white+space+character+among+the+padding+characters.

Code:
====

 protected void cbpTestComponents_Callback(object sender, CallbackEventArgsBase e)
{
         for(int i=0;i<3;i++)
        {
                   WebChartControl  dynamicCharControl = new WebChartControl();
                   dynamicCharControl.ShowLoadingPanel = false;
                  dynamicCharControl.ID = "grphDynmicChart_MyDashboard";
                  dynamicCharControl.ClientInstanceName = dynamicCharControl.ID;
                  pnlTestComponents.Controls.Add(dynamicCharControl);
                  dynamicCharControl.DataSource = searchresultDt;
                  dynamicCharControl.DataBind();
                 dynamicCharControl.EnableCallBacks = true;
                 dynamicCharControl.Width = 620;
                 dynamicCharControl.Height = 220;
      }

}
I am getting above exception during the controls add at  cbpTestComponents_Callback

Solution:
======
Here i found the problem is dynamically created control ID(  dynamicCharControl.ID = "grphDynmicChart_MyDashboard";) is same for all the dynamically created controls. So i have to give unique name to each dynamically created controls at runtime.

issue Fix Code:
==========

 protected void cbpTestComponents_Callback(object sender, CallbackEventArgsBase e)
{
         for(int i=0;i<3;i++)
        {
                   WebChartControl  dynamicCharControl = new WebChartControl();
                   dynamicCharControl.ShowLoadingPanel = false;
                  dynamicCharControl.ID = "grphDynmicChart_MyDashboard_" +i.ToString();
                  dynamicCharControl.ClientInstanceName = dynamicCharControl.ID;
                  pnlTestComponents.Controls.Add(dynamicCharControl);
                  dynamicCharControl.DataSource = searchresultDt;
                  dynamicCharControl.DataBind();
                 dynamicCharControl.EnableCallBacks = true;
                 dynamicCharControl.Width = 620;
                 dynamicCharControl.Height = 220;
      }

}




Wednesday, 4 September 2013

How to Display context menu in AspxGridView Column Headers


Default.aspx:
=============

<dx:ASPxGridView ID="grvContexMenuExample" runat="server" AutoGenerateColumns="false" KeyFieldName="ID" EnableViewState="true" ClientInstanceName="grdtest" Width="100%" Settings-GridLines="None" OnHtmlRowPrepared="grvContexMenuExample_HtmlRowPrepared">
    <ClientSideEvents ContextMenu="function(s,e) {
             if(e.objectType == 'header')
              {
                 headerContextMenu.ShowAtPos(e.htmlEvent.clientX, e.htmlEvent.clientY);
}
                                                         else if(e.objectType == 'row')
                                                         {
                                                             headerContextMenu.ShowAtPos(e.htmlEvent.clientX, e.htmlEvent.clientY);
                                                         }
                                                    }" />
    <Columns>

    <%--Your columns goes here--%>
        <columns>
</dx:ASPxGridView>

<!--Start New  Context Menu !-->
<dx:ASPxPopupMenu ID="mnContextMenu" runat="server" ClientInstanceName="headerContextMenu"
    EnableAnimation="false" PopupHorizontalAlign="OutsideRight" PopupVerticalAlign="TopSides"
    PopupAction="RightMouseClick">
    <Items>
        <dx:MenuItem Text="New Context Menu1">
        </dx:MenuItem>
    </Items>
    <ClientSideEvents ItemClick="ContextMenuItemClick" />
</dx:ASPxPopupMenu>
<!--End New   Context Menu !-->






Default.aspx.cs:
================

  protected void grvContexMenuExample_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
        {


            if (e.RowType == GridViewRowType.Data)

                if (e.RowType == GridViewRowType.Header)
                {

                    e.Row.Attributes.Remove("oncontextmenu");
                }


        }

Saturday, 31 August 2013

AspxGridView Client Side Events and Client Side Properties

1. How to check the column name exist in the aspxgridview client side
============================================
function GetColumn(s, e) 
{ 
      var MsgIDcolumn = s.GetColumnByField( "MsgID");           
       if (!!MsgIDcolumn) 
      {   
           return MsgIDcolumn;      
      }
}

2. How to get column values from the aspxgridview in client side
==========================================
function ShowValues(s, e) {
    s.GetRowValues(e.visibleIndex, 'ReletedWithChildId;ID',DisplayValues);
}

function DisplayValues(RelatedWithIDData)
{
    alert("ReletedWithChildId:" + RelatedWithIDData[0]);  alert("ID:" + RelatedWithIDData[1]);
}

How to Send Email from Python

Please find the below sample code to send email from Python. import os import smtplib from email.mime.multipart import MIMEMultipart...