|
Hi All,
I have one datarow which contains some rows. Now i am copying values from datarow to arraylist using forloop.
But this is again taking some time.
Now i want copy values form datarow to arraylist or array without using forloop.
Is there any way to implement this using LINQ or any other concept.
The code which i used is mentioned below.
DataTable myTable = null;
DataRow[] foundRows = null;
ArrayList RequiredList = new ArrayList();
Array[] arrayForData = null;
ArrayList arrayListFordata = new ArrayList();
DataSet dsForData = null;
if (Session[strSessionDataList] == null)
{
CatalogController _controller = new CatalogController();
Session[strSessionDataList] = arrayListFordata;
}
else
{
dsForData = new DataSet();
dsForData = Session[strSessionDataList] as DataSet;
myTable = dsForData.Tables[0];
if (myTable.Rows.Count > 0)
{
foundRows = myTable.Select("val like '" + item + "%'");
arrayForData = new Array[foundRows.Length];
foundRows.CopyTo(arrayForData, 0); This is not working, it is giving runtime error like type mismatch
//for (int count = 0; count < foundRows.Length; count++)
//{
// RequiredList.Add(foundRows[count].ItemArray[0].ToString());
//}
//for (int count = 0; count < myTable.Select("val like '" + item + "%'").Length; count++)
//{
// RequiredList.Insert(count, myTable.Select("val like '" + item + "%'")[count].ItemArray[0]);
// //foundRows.ItemArray[count] = myTable.Select("val like '" + item + "%'")[count].ItemArray[0];
//}
}
}
if (RequiredList.Count == 0) RequiredList.Add("Fail");
//return RequiredList;
modified on Wednesday, July 1, 2009 4:31 AM
|
|
|
|
|
Try using Property
objRow.ItemArray
|
|
|
|
|
Hi,
I want to maintain state of radiobuttons while paging in gridview control.Is there any solution plz reply me asap.
Thanks
Farogh Haider
Web developer
|
|
|
|
|
|
Thanks, for reply
Actually, I have developed this project like as online quiz and there is one question is display at a time and there is two buttons(Next & Previous) and I am using radiobuttonlist to populate options of that question.
I want to maintain state of checked option when i click on previous/next button
Farogh Haider
Web developer
|
|
|
|
|
Solution 1:
Store in session
Solution 2:
Create a temporary datatable and keep on updating the radio button status there.
Niladri Biswas
|
|
|
|
|
hello
Reading this article on TreeView control...[^], it shows how to either bind a xml file on disk to TreeView control via "XmlDataSource"
<br />
<div><br />
<asp:TreeViewExpandImageUrl="Images/closed.gif"<br />
CollapseImageUrl="Images/open.gif"ID="TreeView1"<br />
Runat="server"DataSourceID="XmlDataSource1"><br />
<DataBindings><br />
<asp:TreeNodeBindingDataMember="Category"<br />
ValueField="ID"TextField="Name"><br />
</asp:TreeNodeBinding> <br />
<asp:TreeNodeBindingDataMember="Description"<br />
ValueField="Value"<br />
TextField="Value"><br />
</asp:TreeNodeBinding><br />
</DataBindings><br />
</asp:TreeView> <br />
</div><br />
<div><br />
<asp:XmlDataSourceID="XmlDataSource1"Runat="server"<br />
DataFile="~/Data/Categories.xml"><br />
</asp:XmlDataSource><br />
</div><br />
My question are:
1. how can we bind an in-memory (not on disk) XmlDocument object to a XmlDataSource? and thus TreeView control? In the article author has suggested an alternative - OnTreeNodePopulate event - however, this is not suitable for my case as my whole list/hierarchy is loaded in one go, not once-per-node.
2. how can we set navigation Url? in standard "web.sitemap", you can do this with siteMapNode's "Url" attribute. But now that, as in above example, uses my own custom Xml... how do we do this?
Thanks
dev
|
|
|
|
|
Hi I am populating a Dropdownlist using clientside script.Later, when I am trying to access the dropdownvalue from server side code,it's coming blank.
I have tried the following:
string val=DropDownList1.Text;
I have also tried
string val=DropDownList1.Attributes["value"];
But none worked.
Please guide me to solve this.
CC26
|
|
|
|
|
If you are populating the Dropdown using client side script(JavaScript), then you cannot read dropdown value at server.
Dropdown clears when page post back.
If you need to read the value, save the selected value of dropdown into the hidden text box, using JavaScript(Before Page Post Back). Now read the textbox value.
|
|
|
|
|
Thanks Aman ....that's a great n working reply....even i was also thinking of the same solution.
CC26
|
|
|
|
|
Hi fellow coders,
I'm trying to do a HTTP GET request but I get this error: Unable to read data from the transport connection.
Below is my code:
Dim web As New System.Net.WebClient
Dim stream As Stream = web.OpenRead(URI)
Dim reader As StreamReader
reader = New StreamReader(stream)
strResult = reader.ReadToEnd
Note I cant do POST as the URI does not support that.
Thank you in advance.
|
|
|
|
|
This question has NOTHING to do with ASP.NET
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
You never do a webclient request in ASP.NET? well, then too bad...
|
|
|
|
|
Just because it's *possible* to do something in ASP.NET, does not make it an ASP.NET question. If I can do it in a winforms app, then it's just a C# question.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Some people are just not helpful are they?
If you got nothing to say, then dont reply!
If I'm wrong then you can at least point me to the right direction, you dont have to sound so rude you know!
|
|
|
|
|
FYI when people are incapable of even working out where to post a question, I point them in the right direction BECAUSE a question asked in the right forum, is more likely to get an answer.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
string strUrl = "http://www.abc.com/a.aspx";
Uri url = new Uri(strUrl);
string strFinal = url.ToString();
WebRequest objWebReq = WebRequest.Create(strFinal);
WebResponse objWebRes = objWebReq.GetResponse();
Stream objStream = objWebRes.GetResponseStream();
StreamReader objStreamReader = new StreamReader(objStream);
string strHTML = objStreamReader.ReadToEnd();
|
|
|
|
|
Hi Aman,
Thank you for your help.
I have tried your solution, but I'm still getting "Unable to read data from the transport connection" at this line objStreamReader.ReadToEnd
The URI is ok though, please advice...
|
|
|
|
|
|
WebClient class wraps all these nicely. So you don't have to use WebRequest or WebResponse explicitly unless it is really required.
|
|
|
|
|
I have a large array of Imagebuttons on an ASPX page, that have the URL set depending upon the value of a variable
The value matches the name of the ImageButton as below. Rather than the convoluted code as below is there a way to somehow dynamically change the button - something like
ImageButton[mapflag].ImageUrl="warning.gif"
if (mapflag == "TV1_ANALOGUE") TV1_ANALOGUE.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_DTT") TV1_DTT.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_DTH") TV1_DTH.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_FM") TV1_FM.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_LINKING") TV1_LINKING.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_ISN") TV1_ISN.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV1_EXTEND") TV1_EXTEND.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV2_ANALOGUE") TV2_ANALOGUE.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV2_DTT") TV2_DTT.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV2_DTH") TV2_DTH.ImageUrl = "warning.gif"; <br />
if (mapflag == "TV2_FM") TV2_FM.ImageUrl = "warning.gif";
Many thanks for any help
|
|
|
|
|
Building a map of strings to buttons is about your only option, unless you have an event and can make the button the tag for the event that causes this to happen
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks Christian
I was afraid that was the case
|
|
|
|
|
hello code project gurus.
i am very new to asp.net i have developed a simple two page website where i can view first page as anonymous where as i need to login to be able to view the second page.
web pages are developed in asp.net 2.0 and sql 2005 my hosting has created a database named xyz and given me server login details
Server Name:HamaraShehar.com,25000
Log In:loginxxx
Password:passwdxxx
now i need to upload this solution to my shared hosting space and see if it works there.
please guide me how to do so.
thanx in advance.
|
|
|
|
|
Well, it depends on the host, if they have SQL Server installed, and how they give you access to it, to set up your DB
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|