Hi I'm really new to C#, more familiar with .ne but haven't code much in a while.

I am not sure how to populate a table with data after clicking a search button.. know how to do this in .net but eve after looking at examples I'm not sure how to do this in C#

this is what I have in .net but i need to find a way to do it in C# since the whole project will be in C#.
is there another way to use "Dim" ?

protected Sub seachMarks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles searchMarks.Click
 
  Dim systemmgr As New SchoolSystem.Controller
        Dim myDS As DataSet
        Try
            myDS = systemmgr.GetMarkSubmissionList(courseid.Text, semester.Text)
            If myDS.Tables(0).Rows.Count = 0 Then
                FormMessage.Text = "No students in this course/semester."
            Else
                myDS.Tables(0).DefaultView.Sort = "Name ASC"
                MarkList.DataSource = myDS.Tables(0)
                MarkList.DataBind()
            End If
        Catch ex As Exception
            FormMessage.Text = ex.Message
        End Try
    End Sub

A few things about your post
1) Use Code tags like this , if you didn't already know.
2) .NET is not a language, the language you are using is VB.
3) If you already know to program on .NET with VB its not too difficult to learn to do it in C#. Here is a starter.

If you know VB.net, then C# become simpler for you to learn. Some of the things you are used to doing in VB using the .Net frame work are still available in c# only the syntaxes are different. I have converted your code to C# for you so that you can compare and learn from it.

protected void seachMarks_Click(object sender , EventArgs e)
	   {

	          SchoolSystem.Controller systemmgr;
	   	 	
	   	DataSet myDS;
	   	
	   	try
	   	{
	   	myDS = systemmgr.GetMarkSubmissionList(courseid.Text, semester.Text);
	   		if(myDS.Tables[0].Rows.Count == 0)
	   		{
	   			FormMessage.Text = "No students in this course/semester.";
	   		}
	   		else
	   		{
	   			myDS.Tables[0].DefaultView.Sort = "Name ASC";
	   			MarkList.DataSource = myDS.Tables(0);
	   		    MarkList.DataBind();
	   		}
	   		
	   		 
	    }

    	     catch (Exception ex)
	   	{
	   		FormMessage.Text = ex.Message;
	   	}
	   }
    }

If you know VB.net, then C# become simpler for you to learn. Some of the things you are used to doing in VB using the .Net frame work are still available in c# only the syntaxes are different. I have converted your code to C# for you so that you can compare and learn from it.

protected void seachMarks_Click(object sender , EventArgs e)
	   {

	          SchoolSystem.Controller systemmgr;
	   	 	
	   	DataSet myDS;
	   	
	   	try
	   	{
	   	myDS = systemmgr.GetMarkSubmissionList(courseid.Text, semester.Text);
	   		if(myDS.Tables[0].Rows.Count == 0)
	   		{
	   			FormMessage.Text = "No students in this course/semester.";
	   		}
	   		else
	   		{
	   			myDS.Tables[0].DefaultView.Sort = "Name ASC";
	   			MarkList.DataSource = myDS.Tables(0);
	   		                MarkList.DataBind();
	   		}
	   		
	   		 
	     }

    	     catch (Exception ex)
	   	{
	   		FormMessage.Text = ex.Message;
	   	}
	   }
    }

you need to fire the select query.....when click search..at that time..

pass your search parameter and bind the datagrid...

i'm sure that will work...

hope it helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.