Binding Individual row to individual labels

Course Queries Syllabus Queries 3 years ago

6.43K 2 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago

 

// design

// in design view there are 10 labels (lblq1,lblq2....lblq10)

// Code

public void bindquestions() { try {

        strqry = "select DISTINCT feedbackformusers.questionid as questionid,questions.question as question from feedbackformusers inner join questions on feedbackformusers.questionid=questions.questionid where feedbackformusers.empid=@empid and feedbackformusers.feedbackformid=@feedbackformid and feedbackformusers.isactive='yes'";

//output of query

//questionid question

// 1 Teacher covers the whole syllabus prescribed by the University ?

// 2 Make the concept clear, simple and interesting ?

// 3 Simplifies difficult topics by giving examples and makes the lecture interesting.

// 4 Uses logical, purposeful and thought-provoking questions for student participation.

// 5 Availability beyond normal classes and cooperation to solve individual problems.

// 6 Speaks clearly and confidently with adequate loudness.

// 7 Maintains proper discipline in the classroom.

// 8 Motivates the students to grow higher in life and to improve their shortcomings.

// 9 Regularity and punctuality.

// 10 Motivates the students to ask questions and to give answers in the classroom.

        cmd = new SqlCommand(strqry, con);

        cmd.Parameters.AddWithValue("@empid", ddlemployee.SelectedValue);

        cmd.Parameters.AddWithValue("@feedbackformid",Session["feedbackformid"].ToString());
        if (con.State == ConnectionState.Closed)
        { con.Open(); }

         drd = cmd.ExecuteReader();

//i knw the code will written here

// and i want to bind the output questions with 10 labels of the designview.

// I'm confused what to do here, to bind with every individual labels,

// i hope now everyone can understand

    }
    catch (Exception a)
    {
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Alert", "alert('" + a.ToString() + "')", true);
    }
    finally
    {
        drd.Close();
        con.Close();
    }

}
0 views
0 shares

profilepic.png
manpreet 3 years ago

Am not into asp.net much.. but using an adodb recordset u can access the database with an sql nd get each row from the recordset using its item property and assign it to label.text

in vb.net the label itself has a databinding property.. so its simple there.

in asp.net an adodb recordset or oledb table adapter should do fine i suppose


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum