views:

325

answers:

2

Is this possible?

EDIT I want to user the asp:ListView

  1. List item
  2. I want to use it for editing
  3. I dont want the postback to use Javascript when I put it into the edit mode

I've been trying to use a to do this instead of a link button but to no avail.

.

+3  A: 

The only way to trigger a PostBack without JavaScript is by using a submit button. This is an HTML limitation, not an ASP.NET one.

I'm a little unsure of what you're trying to do without more detail. If I knew more specifically what you're trying to accomplish I could give you more details.

Dan Herbert
A: 

Like you mentioned in your post, you could use the <a> tag to send the user to the page you want.

You can add information to the link like so:

<a href="./newpage.aspx?action=newitem">Click here for a new item</a>

Then in the page load of newpage.aspx you can check what the action the user selected was, the query parameters are stored in the Request (Language is C#).

protected void Page_Load(object sender, EventArgs e)
{
    string action = Request.Params["action"];
    if(!String.IsNullOrEmpty(action))
    {
        switch(action)
        {
            case "newitem":
                //handle the new item action
                break;
            case "deleteitem":
                //handle the delete item action
                break;
            //handle other actions.
        }
    }
}

EDIT: You should be aware that the <a> tag will send the user to the page specified, the page though will act as if it is the first time the user has visited the page. With that said, the page variable IsPostBack will be false.

Chris