Вопрос

I have 2 aspx pages.. (view.aspx,edit.aspx). under view.aspx I have grid which displays the following fields. class,photo,photocaption,Edit which consists of class name, image of the class and a caption for the photo and a link button for edit which traverses to edit.aspx...

under edit.aspx, I have a table consisting of

Class(a drop down box),
Photo(text box with BROWSE button),
photocaption(Textbox).

when i click on the edit in view.aspx, I must get the entered values in the view.aspx grid by default in edit.aspx table..

Please help me to finish my Task...

Это было полезно?

Решение

Assuming your view.aspx page has a TextBox control for the class name called txtClassName, you can add a query string to your edit.aspx like this:

<asp:LinkButton ID="EditLink" runat="server" Text="Edit" PostBackUrl='<%# "edit.aspx?classname=" + txtClassName.Text %>' />

This creates the url in this format:

edit.aspx?classname=class1

Then, in the Page_Load event of your edit.aspx page, you can retrieve the selected class name like this:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string className = Request.QueryString["classname"];

        // code to output the class details      
        // for example, if you want to add the class name to a dropdownlist:
        DropDown1.Items.Add(className);
    }
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top