Jump to content
Software FX Community

Update Datagrid using .NET Control from client side?


lewis_leeheng
 Share

Recommended Posts

You need to capture the DataChangedByUser client side event in your JavaScript.

Here is the sample code:

<SCRIPT  LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)"><!-- // Prevent changes to second series if (e.Series == 1) e.Handled = true;--></SCRIPT>

Note: The .NET control requires FULL TRUST in order to fire events to IE.

Link to comment
Share on other sites


Hi Frank,

  Thank you for your reply.

  But I would like to allow user to edit those column hightlighted in RedBox as below Only and do not allow user to edit the label for The Series Labels ( Series 1, Series 2, Series 3) and X Labels (1,2,3,4,5....10). Are we able to use coding to control the above features on the Datagrid?

If possible, could you please help to provide some examples?

 

Kindly advice. Thank You. 
Posted Image 

Regards

Lewis
 

Link to comment
Share on other sites

Hi Frank,

  Thank you for your reply.

  I would to ask is there whether when user after edit the Data Point value on the datagrid, Point Labels on the charts also changes at the same time. The Point Labels i would like to display out on my customize point labels.

  Are we able to use coding to control the above features on the Point Labeling? Below is my Test Program to try out on this customize Point Labels but it doesnt work on it.  

If possible, could you please help to provide some examples? 

**********************************************************************************************************************************

    <SCRIPT  LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)">       // Prevent changes to series & Coloumn Header if (e.Series == -1 || e.Point == -1)   e.Handled = true; else {   //alert(" S-" + e.Series + " P-" + e.Point);       Chart1.Points( e.Series,e.Point ).PointLabels.Format = FormatValueToCustomPL( e.Value ); // Format the Current Value to Point Labeling   Chart1.Points( e.Series,e.Point ).PointLabels.Angle = 90;   Chart1.Points( e.Series,e.Point ).PointLabels.Alignment = StringAlignment.Near;   Chart1.Points( e.Series,e.Point ).PointLabels.LineAlignment = StringAlignment.Far;   Chart1.Points( e.Series,e.Point ).PointLabels.Visible = True; }     </SCRIPT>

**********************************************************************************************************************************

Kindly advice. Thank You. 

Regards

Lewis

 

Link to comment
Share on other sites


Hi Frank,

    Thank you for your reply.

    The default point label format only show the value of the point, but i need to convert this point values to time usages description for each point. Below is my sample of the chart.

Q1 - Is there possible when DataChangedByUser it also able to perform convert point values to time usages description and display on Point Label at the same time ?

Q2 - When Chart1_UserCallback is trigger, is it possible that we able to get the DataChangedByUser current point value from Datagrid?

Q3-  When UserCallBack it seens like automatic reload back to previous data but not update the lastest (user entered value) point value. Why it not able to update the lastest point value on chart?

If possible, could you please help to provide some examples?
Posted Image

**********************************************************************************************************************************

Test.aspx 

    <chartfx7:chart id="Chart1" runat="server" height="450px" width="900px" RenderFormat=".NET" OnUserCallback="Chart1_UserCallback"> 

    <script type="text/javascript" language="javascript">
 
  function Charfx_DatagridOnChanged(iposIndex)
  {
  SFX_SendUserCallback('Chart1', iposIndex, false);
  }

  </script>
 
  <SCRIPT  LANGUAGE="JavaScript" FOR="Chart1" EVENT="DataChangedByUser(sender, e)">

// Prevent changes to second series
if (e.Series == -1 || e.Point == -1)
  e.Handled = true;
else
{
  var posIndex = e.Series + ':' + e.Point;
  Charfx_DatagridOnChanged(posIndex);
}

  </SCRIPT>

 

Test.aspx.vb 

'<summary> To UserCallBack Perform ChartFX Events </summary>
Protected Sub Chart1_UserCallback(ByVal sender As Object, ByVal e As ChartFX.WebForms.UserCallbackEventArgs) Handles Chart1.UserCallback

  Dim arPos(2) As String
  Dim jParam As String = e.Param

  Dim jSeries, jPoint As Integer
  Dim test As Double

  Dim splitter1 As Char() = {":"c}

  arPos = jParam.Split(splitter1)

  jSeries = Convert.ToInt16(arPos(0))
  jPoint = Convert.ToInt16(arPos(1))

  'Chart1.Titles.Add(New TitleDockable(e.Param))
  e.Result = DateTime.Now.ToString()

  Chart1.Series(0).PointLabels.Visible = True

  test = Chart1.Data(jSeries, jPoint).ToString()

  Chart1.Points(jSeries, jPoint).PointLabels.Format = FormatValue2TimeDescr (Chart1.Points(jSeries, jPoint).Text)
  Chart1.Points(jSeries, jPoint).PointLabels.Angle = 90
  Chart1.Points(jSeries, jPoint).PointLabels.Alignment = StringAlignment.Near
  Chart1.Points(jSeries, jPoint).PointLabels.LineAlignment = StringAlignment.Far
  Chart1.Points(jSeries, jPoint).PointLabels.Visible = True

  End Sub
 

**********************************************************************************************************************************

Kindly advice. Thank You.


Regards

Lewis 

 

Link to comment
Share on other sites

I see now.

You are in the right track with UserCallback. What I suggest you do is this:

1) Set chart.AllSeries.PointLabels.Format = "%L"

This instruct Chart FX to display the Text property in the Point Label.

2) Keep processing the DataChangedByUser now and keep sending the UserCommand event. In the DataChangedByUser event you can get e.Text as the text beign entered. You can pass that back to your UserCommandEvent. For example:

 var posIndex = e.Series + ':' + e.Point + ':' + e.Text;

3) In your UserCommand event, instead of:

  Chart1.Points(jSeries, jPoint).PointLabels.Format = FormatValue2TimeDescr (Chart1.Points(jSeries, jPoint).Text)   Chart1.Points(jSeries, jPoint).PointLabels.Angle = 90   Chart1.Points(jSeries, jPoint).PointLabels.Alignment = StringAlignment.Near   Chart1.Points(jSeries, jPoint).PointLabels.LineAlignment = StringAlignment.Far   Chart1.Points(jSeries, jPoint).PointLabels.Visible = TrueDo:

  Chart1.Points(jSeries, jPoint).Text = <converted time value>;

You are going to get the value as entered in the DataGrid from e.Param

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...