How do you bind array to gridview? Will it works?
Answers were Sorted based on User's Feedback
int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8 };
GridView1.DataSource = arr;
GridView1.DataBind();
try this.
Is This Answer Correct ? | 24 Yes | 5 No |
Answer / uma
all the answers are correct, but its not write way to store
array to grid,if u insert data into grid view as the above
mension answers expect first one answer, the data will be
diaplayed in column wise, actually the data in grid view is
displayed in rowwise, so we convert array data into a
spesfic datasource like lists,generic list etc;
int32[] arr=new int32[10];
arr[1]=2;
arr[2]=3;
list<> lt=new list<arr>
lt.add(arr[1]);
lt.add(arr[2]);
GridView1.DataSource = lt;
GridView1.DataBind();
Is This Answer Correct ? | 9 Yes | 10 No |
Answer / mallu
Dim i As Integer
Dim fib(10) As Integer
fib(0) = 1
fib(1) = 1
For i = 2 To 10
fib(i) = fib(i - 1) + fib(i - 2)
Next
Me.grdResults.DataSource = fib
Me.grdResults.DataBind()
Is This Answer Correct ? | 5 Yes | 7 No |
Answer / alpesh
get the values in to the array
now pull that array values in one Dataset haveing same
array structure
now assign that dataset to the grid view
thats it
Is This Answer Correct ? | 7 Yes | 10 No |
How do you specify whether your data should be passed as Query string and Forms (Mainly about POST and GET)
1.What are the types of events in asp.net? 2.what is databind? 3.what is COM objects? 4.Difference between gridview and datalist? 5.what is SOAP? 6.what are contents are available in asp.net page? 7.what are types of error?
1 Answers CompuRx Infotech, Gemini, Gemini Communication,
Can we set master page as a start page?
What is difference between response.redirect and server.transfer ?
2 Answers Kalinga Software, Satyam,
What Name space does the web page belon in the .net framework class hierarchy?
asp.net interview questions
Hi this is the coding for adding data in to an xml table i want the coding for update and delete Try Dim emp_xml_doc As New XmlDocument If System.IO.File.Exists(Server.MapPath("emp.xml")) Then emp_xml_doc.Load(Server.MapPath("emp.xml")) Dim myrow_element As XmlElement myrow_element = emp_xml_doc.CreateElement("EmpDetails") Dim str As String str = "<EmpID>" & TxtEmpId.Text & "</EmpID>" & _ "<Empname>" & TxtName.Text & "</Empname>" & _ "<EmpSalary>" & TxtSalary.Text & "</EmpSalary>" myrow_element.InnerXml = str emp_xml_doc.DocumentElement.AppendChild(myrow_element) emp_xml_doc.Save(Server.MapPath("emp.xml")) Response.Write("Record Saved") Dim ds As New DataSet ds.ReadXml(Server.MapPath("emp.xml")) GridView1.DataSource = ds GridView1.DataBind() Else Response.Write("File does not exist.") End If Catch ex As Exception Response.Write(ex.ToString) End Try *********************** this is the xml file <?xml version="1.0" encoding="utf-8" ?> <Employee> <empdetails> <empid>100</empid> <empname>xxx</empname> <empsalary>2000</empsalary> </empdetails> <EmpDetails> <EmpID>yyy</EmpID> <Empname>dddd</Empname> <EmpSalary>77777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrrr</EmpID> <Empname>rrrr</Empname> <EmpSalary>6666</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>qaqa</EmpID> <Empname>sini</Empname> <EmpSalary>50000</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>errrrrrrrr</EmpID> <Empname>rrrrrrrrr</Empname> <EmpSalary>677777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrr</EmpID> <Empname>rrr</Empname> <EmpSalary>33</EmpSalary> </EmpDetails> </Employee>
How you can manage the state of application at the server side in ASP.NET?
What is the page life cycle in asp.net?
What is difference b/w Data Grid in ASP.Net 1.1 and Gridview in 2.0
What are the server control tags in asp.net.?
What are sessions used for?