PDA

View Full Version : سوال: پیدا کردن تک خاص از صفحه از طریق codbeheind



minaalamshahi
سه شنبه 04 مرداد 1390, 17:06 عصر
با سلام
من احتیاج دارم که treeview های هر فرمم رو پیدا کنم به این خاطر از دستورات زیر استفاده کردم

private void getelem(string str1)
{
WebClient MyWebClient = new WebClient();
// Read web page HTML to byte array
Byte[] PageHTMLBytes;
if (str1 != "")
{
PageHTMLBytes = MyWebClient.DownloadData(str1);
// Convert result from byte array to string
// and display it in TextBox txtPageHTML
UTF8Encoding oUTF8 = new UTF8Encoding();
string st = oUTF8.GetString(PageHTMLBytes);
getele(st, 0);


}
}

///
private ArrayList getele(string st, int loop)
{
for (int i = loop; i < st.Length - 1; i++)
{
int index = st.IndexOf("<asp:TreeView");
if (index != -1)
{
m_text.Add(index);
//indexall[j] = index;
//j++;
//Response.Write(st.IndexOf("<div>", 0));
loop = index;

}
}

for (int y = 0; y < m_text.Count; y++)
{
int from = st.IndexOf("ID", int.Parse(m_text[y].ToString()));
s12 = st.Substring(from + 4, 1);
from++;
stid += s12;
from = from + 4;
while (s12 != "\"")
{
s12 = st.Substring(from++, 1);
stid += s12;
}
}
return m_text;
}

اما مشکلی که هست tree ها رو یکی در میون بهم نشون میده بعضی رو میده بعضی رو نه
کسی میتونه در این مورد من و راهنمایی کنه
با تشکر