如何在checkboxlist中设置对listitem的关注 [英] how to set focus on listitem within checkboxlist

查看:102
本文介绍了如何在checkboxlist中设置对listitem的关注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好专家,

我在复选框列表中有十多个列表项(autopost back设置为true表示复选框列表),如果我检查任何listitem第二/第三/第四列表项焦点被设置回来首先列出复选框列表中的项目。是否有任何解决方案专注于检查项目?

谢谢



这里是代码

hello experts,
I have more then ten list items in a checkboxlist (autopost back set to true for checkboxlist), If i check any listitem 2nd/3rd/4th list item focus is set back to first list item in the checkbox list. Is there any solution that focus stays at the checked item?
Thanks

here is code

string value = string.Empty;
        string result = Request.Form["__EVENTTARGET"];
        string[] checkedBox = result.Split('$'); 
        int index = int.Parse(checkedBox[checkedBox.Length - 1]);
        if (chk_Bhid.Items[index].Selected)
        {
            value = chk_Bhid.Items[index].Value;           
        }

推荐答案

');
int index = int .Parse(checkedBox [checkedBox.Length - 1 ]);
if (chk_Bhid.Items [index] .Selected)
{
value = chk_Bhid.Items [index] .Value;
}
'); int index = int.Parse(checkedBox[checkedBox.Length - 1]); if (chk_Bhid.Items[index].Selected) { value = chk_Bhid.Items[index].Value; }


我自己找到了解决方案

I have found Solution myself
<script type="text/javascript">
             var xPos, yPos;
             var prm = Sys.WebForms.PageRequestManager.getInstance();
             function BeginRequestHandler(sender, args) {
                 if (


get(' <%= Div1.ClientID%>') != null ){
xPos =
get('<%=Div1.ClientID%>') != null) { xPos =


这篇关于如何在checkboxlist中设置对listitem的关注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆