webabcd - 专注于asp.net

ASP.NET
从现在开始 一切都不晚
posts - 149, comments - 4168, trackbacks - 344, articles - 0
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

最新评论

共84页: 1 2 3 4 5 6 7 8 9 下一页 末页 
虽然效率很低,但搞了一天终于搞定了,打算改源码来提高效率。可以在OnDataBound里调用初始化函数,实现翻页选中和选中导出了,谢谢LZ和蜗牛身上的一只蚂蚁
@webabcd
谢谢,还有一个问题,就是如上面引用的代码中的问题一样,不知道在哪里调用初始化代码,如果在PageIndexChanged里调用会有问题
re: 扩展GridView控件(索引) - 增加多个常用功能 蜗牛身上的一只蚂蚁 2008-10-07 17:24  
再次感谢LZ大大的分享。。。谢谢。。。。
re: 扩展GridView控件(索引) - 增加多个常用功能 蜗牛身上的一只蚂蚁 2008-10-07 17:23  
@-可乐
List<string> selectedItems = null;
if (AdminWebUtility.SelectedUnPicFolderItems == null)
selectedItems = new List<string>();
else
selectedItems = AdminWebUtility.SelectedUnPicFolderItems;

for (int i = 0; i < this.gvVideoFilePicUnCatalog.Rows.Count; i++)
{
string id = this.gvVideoFilePicUnCatalog.Rows[i].Cells[1].Text;
CheckBox cb = this.gvVideoFilePicUnCatalog.Rows[i].FindControl("itemCheckBoxUnPicFolder") as CheckBox;
if (selectedItems.Contains(id) && !cb.Checked)
selectedItems.Remove(id);
if (!selectedItems.Contains(id) && cb.Checked)
selectedItems.Add(id);
}
就是先定义一个数组对象A(我现在这个定义的是一个List<string>,它跟数组ArrayList 差不多)。循环当前选中的项。如果选中则存在A中。。。最后把A给它就行了。。。
@ailly
这种鼠标经过所显示的提示,肯定是之前一次性的下来的,而不会一条一条地去服务端取
@-可乐
试过以数字或字母开头,没问题

部分代码,参考一下
#region 记录复选框选中状态的逻辑
void SetCheckedItems()
{
var checkedItems = new List<string>();

CheckBox chkParent = null;
HiddenField hdnProductId = null;
ListView lvChild = null;

checkedItems = CheckedItems;
foreach (ListViewItem lvi in lvParent.Items)
{
chkParent = lvi.Controls[0].FindControl("chkParent") as CheckBox;
hdnProductId = lvi.Controls[0].FindControl("hdnProductId") as HiddenField;
lvChild = lvi.Controls[0].FindControl("lvChild") as ListView;

if (chkParent.Checked)
{
if (!checkedItems.Contains(hdnProductId.Value))
checkedItems.Add(hdnProductId.Value);
}
else
{
checkedItems.Remove(hdnProductId.Value);
}

if (lvChild != null)
{
CheckBox chkChild = null;
foreach (ListViewItem lviChild in lvChild.Items)
{
chkChild = lviChild.Controls[0].FindControl("chkChild") as CheckBox;
hdnProductId = lviChild.Controls[0].FindControl("hdnProductId") as HiddenField;

if (chkChild.Checked)
{
if (!checkedItems.Contains(hdnProductId.Value))
checkedItems.Add(hdnProductId.Value);
}
else
{
checkedItems.Remove(hdnProductId.Value);
}
}
}
}

CheckedItems = checkedItems;
}

public List<string> CheckedItems
{
get
{
if (ViewState["CheckedItems"] == null)
return new List<string>();

return ViewState["CheckedItems"] as List<string>;
}
set
{
ViewState["CheckedItems"] = value;
}
}
#endregion
楼主,我想问一下实际应用中一般是怎么处理这问题的
谢谢!
--引用--------------------------------------------------
蜗牛身上的一只蚂蚁: 我是存在ViewState了,可是在哪个方法,或哪个事件里加上要显示的代码呢?。因为点“下一页”或&quot;上一页&quot;。他们的事件方法是重新取出数据值来的啊。
<br> /// &lt;summary&gt;
<br> /// 获取或设置选中项的集合
<br> /// &lt;/summary&gt;
<br> protected ArrayList SelectedItems
<br> {
<br> get
<br> {
<br> return (ViewState[&quot;itemCheckBoxProvinceValues&quot;] != null) ? (ArrayList)ViewState[&quot;itemCheckBoxProvinceValues&quot;] : null;
<br> }
<br> set
<br> {
<br> ViewState[&quot;itemCheckBoxProvinceValues&quot;] = value;
<br> }
<br> }
<br>
<br> //这里的处理是为了回显之前选中的情况--
<br>//这代码放哪个事件或方法里面啊。
<br> if (SelectedItemsValues.Count != 0)
<br> {
<br>
<br> for (int i = 0; i &lt; gv.Rows.Count; i++)
<br> {
<br> string id = gv.Rows[i].Cells[1].Text;
<br> CheckBox cb = gv.Rows[i].FindControl(&quot;itemCheckBoxProvince&quot;) as CheckBox;
<br> if (SelectedItemsValues.Contains(id))
<br> cb.Checked = true;
<br> else
<br> cb.Checked = false;
<br> }
<br>
<br> }
<br>谢谢。。。
--------------------------------------------------------


CheckBox的选中状态在哪里保存进ViewState里的,能将这一功能所有代码贴出来吗,谢谢
@webabcd
请你试试以数字或字母开头,或特殊字符
@TomCat80529
asp.net里的FileUpload控件啊
@-可乐
刚才测试了几个有数字和字母的表头
导出时没问题啊
你好,这个控件中,导出数据时,如果表头为数字或字母开头、或包含特殊字符的话就会报错,请问这是什么原因
请教一下,您的这段程序用在 winform下是没有问题的,但是当我把它迁移到,winweb下 btnDownload_Click(object sender, EventArgs e) 这个方法中的 FolderBrowserDialog fldDlg = new FolderBrowserDialog(); 是有问题的,应该如何更改这个对象,使得在web中也能谈出选择路径的窗体,谢谢!
re: 我的文章索引 webabcd 2008-10-06 08:01  
@黑白
:)
十一快乐
准备中。。。
@共同学习,共同进步
:)
有自己的理解是最好的
@共同学习,共同进步
:)
是的
@共同学习,共同进步
:)
有自己的理解是最好的
@汗怎么能这样
:)
大家方法不一样,适合自己的最好
@熊志文
一般不上qq啊
msn吧
webabcd
hotmail
com
re: 我的文章索引 黑白 2008-10-01 23:41  
兄弟过节快乐
好久没更新了,期待力作
re: 乐在其中设计模式(C#) - 原型模式(Prototype Pattern) 共同学习,共同进步 2008-09-30 09:00  
ShallowCopy 是不是仅仅复制第一个层次
DeepCopy 是复制N个层次.
所以不可以把
public Object Clone()
{
return this.MemberwiseClone();
}
写成
public Object Clone()
{
return this;
}
:)
re: 乐在其中设计模式(C#) - 单例模式(Singleton Pattern) 共同学习,共同进步 2008-09-30 08:16  
@ webabcd
static readonly 肯定是线程安全的.
学习了.这种线程安全是交给了CLR了,我是猜的啊.因为它被赋了一次值就不在可以改变了.这也应该是最简化的单例模式了.
@PPBOY1
我来凑个热闹
接口 : Has a----说明具有某特征的关系
抽象类 : IS a----说明是某一类的关系
比如集合类,都实现了IEnumerable.是不是应该说这个集合具有枚举特征.

AbstractMessageFactory amf = new SqlMessageFactory()
SqlMessageFactory 是它的 AbstractMessageFactory 一个子类,可以说它就是一个AbstractMessageFactory 类型.

其实这是OOP设计中概念上的问题了.在语法上,用哪个都可以运行通过的.


学到了,怎么去了解一门语言的方法。TQ
楼主,能不能教下我,我正在做wcf这方面的一个项目,由于数据比较大所以我想用流传输来操作,但是我按照你的代码进行操作,传上去的都是些空的文件.
楼主能不能把你 的QQ给我.或者加我的QQ:359432451 我将非常感谢!
@Savage
如果你的web.config里
指定了siteMap的defaultProvider属性
那么必须要有与其对应的provider的相关配置
请问LZ,出现这样的错误:
提供程序集合中不存在为 defaultProvider 指定的提供程序“XmlSiteMapProvider”。

是不是缺少什么引用啊?
拜读大作,对您非常钦佩! kongwan 2008-09-24 11:42  
请问,我想在GridView中通过编程添加模板列,而不是在设计时添加,又不会影响已经绑定的数据表,该怎么做?非常感谢!!!
@哲筠
是哪部分有问题?
我试了几个,client和host部署在不同的机器上,没问题啊
大侠,你这个程序client和host在同一台机器上没有问题,但是如果不在同一台机器上,执行client时会报错说:"服务器已拒绝客户端凭据".能不能帮忙研究下啊!
@MVC不是三层
:)
过奖了
好的控件确实是很多,有时间的话一定会多写几个的
楼主,感觉你的控件做的很不错。谢谢!
我试用过SmartGrid这个控件。感觉也比较符合国人的习惯。
楼主有时间研究一下SmartGrid,丰富一下YYControls。
呵呵。
再次感谢!!!
@晓彦
:)
不谢
@cesc
确实,而且实际应用中也没人会这么做的
不过对于学习ajax来讲,这篇文还是很好的
gridview利用HoverMenu可以实现相同功能,
http://cescshen.spaces.live.com/blog/cns!9938238481A866F8!249.entry
刚开始我也是用你这个方法,但提示框弹出位置控制不好.
学习...谢谢!
re: 化零为整WCF(17) - 安全(Security) webabcd 2008-09-22 07:38  
@老乐
你的公钥值设置的对吗
encodedValue
@SYY
嗯,现成的属性肯定是没有
不过可以通过css的方式来设置
你说的那个是结点图片,我要改的是背景。好像不能改哦。。
re: 化零为整WCF(17) - 安全(Security) 老乐 2008-09-19 20:46  
我是直接用vs2008打开你的解决方案,什么都没改,并且其余的项目都能测试成功,证书我已经安装了,麻烦帮我想想,我这段时间一直在看wcf方面的,但security是很关键的,我实在是不知道该怎么解决了
@fenggang
:)
不谢
re: 化零为整WCF(17) - 安全(Security) webabcd 2008-09-19 18:47  
@老乐
没遇到过这样的错啊

看提示可能是没有配置客户端的endpoint的identity,或者配置的不对
@SYY
1、看看TreeNode的ImageUrl属性
2、看看ExpandImageUrl属性和CollapseImageUrl属性
还有前面的加号减号在哪里更改?
如何增加子结点背景图?
楼主指点 老乐 2008-09-19 15:59  
楼主帮一下,我调试不成功,出了一套堆的错误,别的代码没事,只有Security的不成功,我实在不知道从何下手了。

System.ServiceModel.Security.MessageSecurityException: 传出消息的标识检查失败。“http://localhost:3502/ServiceHost/Security/Hello.svc”目标终结点的所需标识为“identity(http://schemas.xmlsoap.org/ws/2005/05/identity/right/possessproperty: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/thumbprint)”。 Server stack trace: 在 System.ServiceModel.Security.IdentityVerifier.EnsureIdentity(EndpointAddress serviceReference, AuthorizationContext authorizationContext, String errorString) 在 System.ServiceModel.Security.IdentityVerifier.EnsureOutgoingIdentity(EndpointAddress serviceReference, ReadOnlyCollection`1 authorizationPolicies) 在 System.ServiceModel.Security.MessageSecurityProtocol.EnsureOutgoingIdentity(SecurityToken token, SecurityTokenAuthenticator authenticator) 在 System.ServiceModel.Security.MessageSecurityProtocol.GetTokenAndEnsureOutgoingIdentity(SecurityTokenProvider provider, Boolean isEncryptionOn, TimeSpan timeout, SecurityTokenAuthenticator authenticator) 在 System.ServiceModel.Security.SymmetricSecurityProtocol.TryGetTokenSynchronouslyForOutgoingSecurity(Message message, SecurityProtocolCorrelationState correlationState, Boolean isBlockingCall, TimeSpan timeout, SecurityToken& token, SecurityTokenParameters& tokenParameters, SecurityToken& prerequisiteWrappingToken, IList`1& supportingTokens, SecurityProtocolCorrelationState& newCorrelationState) 在 System.ServiceModel.Security.SymmetricSecurityProtocol.SecureOutgoingMessageCore(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState) 在 System.ServiceModel.Security.MessageSecurityProtocol.SecureOutgoingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState) 在 System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout) 在 System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) 在 System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) 在 System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) 在 System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout) 在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) 在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) 在 System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 SecuritySvc.IHello.SayHello(String name) 在 SecuritySvc.HelloClient.SayHello(String name) 位置 c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\client\24aa5c7a\92803bb1\App_WebReferences.99oilubg.5.cs:行号 50 在 Sample_Security.btnSayHello_Click(Object sender, EventArgs e) 位置 d:\temp\wcf\WCF\Client\Security\Hello.aspx.cs:行号 32

updatapanel 和 webpart 用在一起时候出现只能拖动一次的情况,3.5的,没有sharepoint,不知道怎么解决
谢谢,已经实现了。感觉控件很好用。
共84页: 1 2 3 4 5 6 7 8 9 下一页 末页