0

I'm designing a sort of hierarchical system, as follows:

Contract
Master Commodity
Commodity
Sub-Commodity
Part

Each one of these are on their own page (for now). The user starts out on the Contract.aspx page. If they want to see the Master Commodities for the contract they are currently on, they will click the "ImageButton" I have set up, and I pass in as a command argument the ContractID (CommandArgument='<%# Eval("ContractID")%>'). This works great- I get to my Master Commodity page with the Master Commodities filtered on the ContractID I passed in.

Here's my problem: Navigating from the Master Commodity page to the Commodity page will (I think) require passing in the ContractID (so we JUST see stuff for the contract we're on), AND the Master Commodity ID (so we JUST see the Commodities that are related to the Master Commodity). I've tried the following:

CommandArgument='<%# Eval("ContractID") + ',' + Eval("MComID")%>', but as you could probably expect, that doesn't work. If I can just do something like above and have a delimiter like the comma, I can go from there and make it work. Any suggestions???

3
  • 3
    "That doesn't work" usually indicates that your question is poorly documented and needs more details. Commented Mar 11, 2011 at 14:27
  • Well I was just looking for any alternative solutions to the problem I was facing. I think I clearly described my goals and intentions, but what I tried didn't work. Anyways, I answered my own question. Commented Mar 11, 2011 at 14:35
  • 1
    Normally, if you bring your car to the service and tell them that your right blinker never flashes, it is much easier to repair than if you just tell them "my car doesn't work". I think the same should apply for software related error descriptions. Commented Mar 11, 2011 at 14:45

3 Answers 3

2

Mike,

borrowing form your own suggested solution you could have kept your ImageButton and used the following:

<%# string.Format("{0},{1}",Eval("value1"),Eval("value2"))%>

Late in the day but thought worth commenting for others following this thread.

Paul.

Sign up to request clarification or add additional context in comments.

Comments

0

What I decided to do is change my ImageButton to an "a href..." and use this as my href:

<%# string.Format("./Commodity.aspx?contractId={0}&MComID={1}, Eval("ContractId"), Eval("MComID"))%>

That way I can pass in all the information I need.

Comments

0

A suggestion is having a method in your code behind, which returns a well-formatted string

internal static string GetFormattedString(string sContractID, string sMcomID){
  return String.Format("{0},{1}", sContractID , sMcomID);
}

you could then Eval this function in your control. this way you keep the logic of formatting in your code behind, and only have to modify it there. This is a good practice if the information is used in different controls ( links ) on your front-end code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.