在使用radgrid的控件的时候。如果你碰到了dropdownlist控件,这个时候我们没有办法在
html的代码里直接设置 selectIndex
也许我们会想如造page 始初化控件的设置方式
if (!Page.IsPostback)
{
bindControl();//在这边进行控件的绑定
}
但是我们会发现。这个Page.IsPostback在加载和回发的时候都是一样,得不到加载状态Callback也是一样
这个时候我们可以用 oninit来实现它了
protected override void OnInit(EventArgs e)
{
this.DataBinding += new EventHandler(Beheer_UserControls_TickerTapeEditor_DataBinding);
base.OnInit(e);
}
![](/Images/OutliningIndicators/None.gif)
void Beheer_UserControls_TickerTapeEditor_DataBinding(object sender, EventArgs e)
{
object target = DataBinder.Eval(DataItem, "StrHtmlTarget");
if (target == null || target is DBNull)
{
ddlTarget.SelectedIndex = 0;
}
else
{
ddlTarget.SelectedValue = (string)target;
}
}
不清楚asp.net自带的grid是否是如些
html的代码里直接设置 selectIndex
也许我们会想如造page 始初化控件的设置方式
if (!Page.IsPostback)
{
bindControl();//在这边进行控件的绑定
}
但是我们会发现。这个Page.IsPostback在加载和回发的时候都是一样,得不到加载状态Callback也是一样
这个时候我们可以用 oninit来实现它了
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
不清楚asp.net自带的grid是否是如些