Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Re: Binding Uniqueid to Shapenode of Shaplist (Read 8058 times)
bhanuprakash007
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Oct 12th, 2009 at 2:09pm
Print Post  
Hi,

     Iam using Shapenodes and iam creating uniqueid for each shapenode like this

function onNodeCreated(sender, args){


  args.getNode().setTag(getUniqueId());
 
   

}
 
function getUniqueId(){
 
    var dateObject = new Date();
    var uniqueId = dateObject.getFullYear() + "" + dateObject.getMonth() + "" +
dateObject.getDate() + "" +
dateObject.getTime();
//alert(uniqueId);   
    //return uniqueId;
    document.getElementById("tbFileName").value=uniqueId;   
    


then iam saving each unique id in to database.

    Now i want to retrive the uniqueid and bind to Shpenodes.Each uniqueid is bind to specific shapenode.

Iam sending the below code for retriveing the uniqueid

  Diagram diagram = diagramView.Diagram;
          diagram.SelectAfterCreate = false;
          ShapeNode start = diagram.Factory.CreateShapeNode(10, 10, 20, 15);

     




          string connstr1 = "Server=196.12.43.134;database=ScoreDB;User Id=Sa;Password=gis*2005;";
          SqlConnection con1 = new SqlConnection(connstr1);
          string query1 = "select location,status,uniqueid from bomsystem where Orderid= 2";
          SqlCommand cmd1 = new SqlCommand(query1, con1);

          SqlDataAdapter da = new SqlDataAdapter(query1, con1);
          DataSet ds = new DataSet();
          da.Fill(ds, "data");


          for (i = 0; i <= ds.Tables["data"].Rows.Count - 1; i++)
          {
              if (tbFileName.Text == ds.Tables["data"].Rows[i]["Uniqueid"])
              {
                  nodename = ds.Tables["data"].Rows[i]["location"] + "-" + ds.Tables[0].Rows[i]["status"];
              }
              
          }


Can u send me the code how to bind the uniqueid to specific shapenode. at server side?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #1 - Oct 12th, 2009 at 3:08pm
Print Post  
There's no built -in data binding available if that's what you are asking. You will have to retrieve the data yourself.
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #2 - Oct 12th, 2009 at 3:17pm
Print Post  
Thanks for your reply.

ya can u suggest me inthis..
I am getting a uniqueid when i draged a node on clientside and it is saving in Database.

Now iam retreiving the uniqueid from database using this query


string query1 = "select NestedID , Status,uniqueid from vwNestedorderDetails where OrderID ='15'";

here i am getting 2 uniqued ids for orderid.Here 2 uniqueids represent 2 shape nodes (for example uniqueid 1111 for start shape node and 2222 for decision shapenode)


Now i want to bind uniqueid 1111 to start shape node and 2222 to decision shape node at server side .Can u Please suggest me to bind the uniqueid for a particular shapenode?
« Last Edit: Oct 12th, 2009 at 4:56pm by kumarsrmt »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #3 - Oct 12th, 2009 at 5:46pm
Print Post  
If you keep the IDs as values of the Tag property, try using the diagram.FindNode(tag) method to get a node by its ID.
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #4 - Oct 12th, 2009 at 5:48pm
Print Post  
Could you please porovide sample code for that..bacause i am working on this since 1 week .



Thanks
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #5 - Oct 12th, 2009 at 5:49pm
Print Post  
can u please send me sample code for the above explaination how to use tag property and bind to shape node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #6 - Oct 12th, 2009 at 5:57pm
Print Post  
I suppose you should add this to your loop -

string id = ds.Tables["data"].Rows[i]["uniqueid"];
ShapeNode node = diagram.FindNode(id) as ShapeNode;
if (node != null) node.Text = nodename ;
  
Back to top
 
IP Logged
 
kumarsrmt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #7 - Oct 12th, 2009 at 7:33pm
Print Post  
hi

I added ur code but it is not binding the node which we are saving in the database.It is binding the default node in diagramview.


for (i = 0; i <= ds.Tables["data"].Rows.Count - 1; i++)



{




if (Session["uid"].ToString() == ds.Tables["data"].Rows[i]["UniqueId"].ToString())




{




string id = ds.Tables["data"].Rows[i]["uniqueid"].ToString();




ShapeNode node1 = diagram.FindNode(ds.Tables["data"].Rows[i]["UniqueId"].ToString()) as ShapeNode;




nodename = ds.Tables["data"].Rows[i]["location"].ToString() + "-" + ds.Tables["data"].Rows[i]["status"].ToString();




if (node != null)




{





node.Text = nodename;




}






}


I tried another way also it is also binding the default node.Below is the code


for (i = 0; i <= ds.Tables["data"].Rows.Count - 1; i++)



{




if (Session["uid"].ToString() == ds.Tables["data"].Rows[i]["UniqueId"].ToString())




{




string id = ds.Tables["data"].Rows[i]["uniqueid"].ToString();




ShapeNode node1 = diagram.FindNode(ds.Tables["data"].Rows[i]["UniqueId"].ToString()) as ShapeNode;




nodename = ds.Tables["data"].Rows[i]["location"].ToString() + "-" + ds.Tables["data"].Rows[i]["status"].ToString();




if (node != null)




{





node.Text = nodename;




}










}









}

So please can u check once?


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #8 - Oct 13th, 2009 at 8:01am
Print Post  
You are setting ShapeNode node1 = diagram.FindNode(...) but then are setting the Text of a "node" object, instead of "node1". Is that "node" what you are referring to as the default node?
  
Back to top
 
IP Logged
 
bhanuprakash007
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #9 - Oct 13th, 2009 at 8:23am
Print Post  
I set like this in my code but still it is displaying the default node of Shapelist.

ShapeNode node = diagram.FindNode(...)

Can u tell any another way to bind the uniqueid to a specific node.

or

You have any sample which u created uniqueid for a partiocaulr node and save it in database abd retriev uniqueid to a Sme node which we have stored in database.Please send me If u have any example.


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #10 - Oct 13th, 2009 at 11:08am
Print Post  
What's this "default node of Shapelist" and where is it displayed? If you call this code after loading the diagram, does it show anything in the VS output window?

foreach (DiagramNode n in diagram.Nodes)
     if (n.Tag != null)
           Debug.WriteLine(n.Tag.ToString());
  
Back to top
 
IP Logged
 
bhanuprakash007
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Sep 29th, 2009
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #11 - Oct 13th, 2009 at 12:45pm
Print Post  

  Hi,

       Actullay it does n't show anything in VS ouptu window. Iam getting the unique id from database but it is not binding to the specific node.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #12 - Oct 13th, 2009 at 2:39pm
Print Post  
Are there any nodes in the diagram at all at this point? What does this show if you add it before the FindNode call?

Debug.WriteLine(diagramView.Diagram.Nodes.Count.ToString());
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #13 - Oct 13th, 2009 at 2:48pm
Print Post  
I have received the email with your code. The code within an "if (!IsPostBack)" executes only when the user requests a page for the first time. At this point you don't have any nodes in the diagram, so FindNode returns null. If you need to refresh the texts for the diagram nodes after postback, you should move your query code to an else block after the "if (!IsPostBack)" one.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Binding Uniqueid to Shapenode of Shaplist
Reply #14 - Oct 13th, 2009 at 2:57pm
Print Post  
If this is about the auto-refresh feature you mentioned some time ago - you should implement it as a postback so that the diagram content is preserved. You should use the Page.ClientScript.GetPostBackEventReference method to get the name of a JS function which you can call to post the page back automatically from the client side.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint