Fitzer has the right of it. I would just add a few caveats.
You have the right (though not the duty) to apply to be a member of any party. They may not accept you even as a member, far less as a candidate.
Your adoption as a candidate is by a local comittee in the constituency where you will serve, and you may justifiably feel that your loyalties are to that local comittee more than to the national party.
Where a policy forms part of the manifesto of your party then you would find it difficult to justify voting against it in the House. It might be morally defensible if something major had happened since the election to cause you to change your mind over the issue. However, it is also arguable that any political party is an assemblage of (more or less) like-minded individuals who will see eye to eye on most issues and not at all on some others. To expect a doctrinaire toe-the-line attitude on every point is therefore unreasonable.
There have always been some issues on which Governments, while recommending one or other course of action, have allowed their adherents a free vote. The abolition/ reintroduction of the death penalty was a case in point. It may also be worth remembering when considering how much any MP truly represents their electorate that the death penalty was taken off and kept off the statute book despite clear evidence that a majority of the electorate (at least initially) were in favour of its retention/ reintroduction.
Finally (at last, I hear you cry!) it is also worth remembering that with our current first past the post system a considerable number of our MPs have been elected by a minority of the people in their constituency. They have a duty to represent all of them and sometimes this also may sway their votes in parliament.