Grid View and Detail View Problem..

Discussion in 'ASP.NET 2.0' started by joelnet, Jun 30, 2006.

  1. Seems like a very specific task. You might have to code it yourself.


    You'll want to use the <ItemTemplate> (i think thats what its called) and just create your own href like this...


    <a href='<%#String.Format("event.aspx?id={0}", DataBinder.Eval(Container.DataItem, "ID"))%>' target="_blank">click me</a>





    note: check my syntax, I just typed this off hand.



    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  2. Hello,

    I'm a new learner...

    I'd like to know there's any sourcecode that i can use to let the selected column in Grid View to openanother page with the Detail View..[​IMG]
    Thanks...
     
  3. wwv

    wwv

    Create instances of the following objects:</o:p>
    </o:p>
    SqlConnection à SqlCommand à SqlDataAdapter à DataSet </o:p>
    </o:p>
    GridView</o:p>
    </o:p>
    Add a Select command field to the GridView1.</o:p>
    </o:p>
    Assume: sqlConnection1, sqlCommand1, sqlDataAdapter1, dataSet1, GridView1</o:p>
    </o:p>
    Initialize the sqlCommand1.CommandText with something like that: ?Select * from ?? or ?Select column1, column2, ? from ?? </o:p>
    Add the following code in the Page_Load or in a button event (enclosed in a try ? catch ? finally block)</o:p>
    sqlConnection1.Open ();</o:p>
    sqlDataAdapter1.Fill (dataSet1);</o:p>
    GridView1.DataSource = dataSet1;</o:p>
    GridView1.DataBind ();</o:p>
    </o:p>
    Create a Session or a Cache object to store the selected index in the GridView1_SelectedIndexChanged event and redirect to the form to display the columns of the selected row of the GridView1. </o:p>
    </o:p>
    You need to have a relationship between the GridView1.SelectedIndex and a key field of the handled table, for instance an ID. (Maybe there are also other methods to establish the selected row of the table based on the selected GridView.SelectedIndex ? I do not know)</o:p>
    </o:p>
    Based on the stored selected index in Session / Cache object select the row of the table and display the fields. </o:p>
    </o:p>
    </o:p>
    Do you need more details? Do not hesitate to contact me!</o:p>
    </o:p>
    Valentin</o:p>
    MCP C#</o:p>
    www.wwv-it.eu </o:p>

    [email protected]</o:p>
     
  4. thanks a lot. i've solved the problem..
     

Share This Page