从viewstate中重新获得价值 [英] retriving value from viewstate
本文介绍了从viewstate中重新获得价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
Plz告诉如何从查看状态中查找特定值,
i有3分别在viewstate,sNO,Name,Contact中分享。
i希望在IF()条件下找到sNo进行比较,
请回答,,
Hello
Plz tell how to find a specific value from view state,
i have 3 cloumns in viewstate,sNO, Name, Contact respectively.
i want to find sNo for comparing in IF() condition ,
Please Answers,,
推荐答案
嘿那里,
假设您想从存储在ViewState中的DataTable中获取BatchNo
:
Hey there,
Let's suppose you want to getBatchNo
from the DataTable that you stored in the ViewState:
if(ViewState["BatchTable"] != null)
{
DataTable dt= (DataTable)ViewState["BatchTable"];
for(int i = 0; i < dt.Rows.Count; i++)
{
string batchNo = dt.Rows[i]["BatchNo"].ToString();
if(batchNo.Equals("Your Value to Compare"))
{
//Do Something
}
}
}
希望这会有所帮助,请告诉我这是不是'你想要的是什么。
Azee ...
Hope this helps, let me know if this isn't what you were looking for.
Azee...
首先你将你的viewstate转换为像datatable这样的特定类型,List< clasobject>
然后你可以过滤它。
Ex。
DataTable myDt =(DataTable)ViewState [viewstatename];
来自myDt,您可以通过if条件过滤您的数据库
请参阅我没有给出任何代码它是一种理解概念的格式
First you have convert your viewstate to a specific type like datatable, List<clasobject>
Then you can filter it.
Ex.
DataTable myDt=(DataTable)ViewState["viewstatename"];
From myDt you can filter your datab by the if condition
See I have not given any code it's a format to understand the concept
首先要将此视图状态转换为数据表
例如
datattable abc =(datatable)viewstate( temp);
之后
你将输入abc.Rows [0] [sNO]。tostring()
试试这个
first of All you have to convert this viewstate into datatable
For Example
datattable abc=(datatable)viewstate("temp");
after this
you will type abc.Rows[0]["sNO"].tostring()
try this
这篇关于从viewstate中重新获得价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文