小编Man*_*ngh的帖子

如何使用VB.net在Formview插入的事件中获取最后插入的标识

我使用VB.net (FormView和ObjectDataSource)和Sql Server 2005.

我想在FormView1_ItemInserted的表中最后插入@@ identity

Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs) Handles FormView1.ItemInserted

End Sub
Run Code Online (Sandbox Code Playgroud)

我的问题是我想在FormView1_ItemInserted之后将FormView重定向到只读模式,但为此我需要以只读模式显示插入的记录,这只有在我最后插入@@ identity时才有可能.你能告诉我在我的申请,程序和代码中我需要做些什么改变才能实现这个目标.

请用示例代码建议!使用VB.net

谢谢.

最诚挚的问候,MS

vb.net sql-server

2
推荐指数
1
解决办法
4654
查看次数

如何使用JQuery实现FLXHR以进行跨域交互

我使用JQuery,FLXHR从Cross Browser获取数据.

下面是示例jquery代码:

        // set up the domain that we're going to call and tell flXHR not to try to parse the response as XML..
 $.flXHRproxy.registerOptions("http://staging/", {xmlResponseText:false});

 // set flXHR as the default XHR object used in jQuery AJAX requests
 $.ajaxSetup({transport:'flXHRproxy'});


 $.ajax({  
        type:"POST",        
        url: "http://staging/Login.aspx",  // Send the login info to this page
        data: str, 
        dataType: "json", 
        success: function(result)
        { 
             // Show 'Submit' Button
            $('#loginButton').show();

            // Hide Gif Spinning Rotator
            $('#ajaxloading').hide();  
        } 

    });  
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我使用JQuery和Flash进行跨浏览器交互,上面的代码工作正常,使用http://staging/Login.aspx,但是当我要使用https://staging/Login.aspx(HTTPS)时验证它给我错误(NS_ERROR_PROXY_CONNECTION_REFUSED) …

jquery

2
推荐指数
1
解决办法
3957
查看次数

在C#中的Page OnInit/OnLoad上添加/删除会话变量

我正在使用C#.

我在C#中使用以下代码:

protected override void OnInit(EventArgs e)
{
    try
    {
        if (Session["boolSignOn"].ToString() == "true".ToString())              
        {              
            lblPanelOpen.Text = Session["panelOpen"].ToString();
        }
        else
        {
            lblPanelOpen.Text = Session["panelOpen"].ToString();
        }
    }
    catch (Exception ex)
    {
        Logger.Error("Error processing request:" + ex.Message);
    }
}
protected override void OnLoad(EventArgs e)
{
    try
    {
        if (!string.IsNullOrEmpty(Session["panelOpen"].ToString()))
        {
            lblPanelOpen.Text = string.Empty;
            Session.Remove("panelOpen");
        }
    }
    catch (Exception ex)
    {
        Logger.Error("Unable to remove the session variable:" + ex.Message);
    }
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我有一个Session["panelOpen"]从另一个用户控件创建的变量,一旦我的页面尝试渲染,我将存储Session["panelOpen"]在我的隐藏lblPanelOpen.Text页面OnInit()方法中,但是当页面被完全加载时,我试图删除会话变量.

请指教!

c# asp.net session-variables

2
推荐指数
1
解决办法
1万
查看次数

给出System.FormatException:String未被识别为有效的DateTime.在C#中使用datetime.ParseExact

我在c#中的代码下面,我将我的字符串类型格式日期转换为datetime,但是给出了错误.

if (!string.IsNullOrEmpty(SessionDictionary.GetValue("UserDetails", "ExpiryDate")))
{
    DateTime ExpiryDate = DateTime.ParseExact(SessionDictionary.GetValue("UserDetails", "ExpiryDate"), "dd mmm yy", null);                      
    strDate = sitedata.FormatDate(ExpiryDate, TridionDateFormat.ShortDate);
}
else
{
    strDate = "-";
}
Run Code Online (Sandbox Code Playgroud)

SessionDictionary.GetValue("UserDetails", "ExpiryDate")的字符串类型数据返回"31/01/2011 00:00:00"格式日期,在我使用DateTime.ParseExact它的上面的代码中给我System.FormatException: String was not recognized as a valid DateTime.错误.

请说明出了什么问题.

谢谢.

.net c# datetime formatexception

2
推荐指数
1
解决办法
2万
查看次数

在C#中使用XPath从XML获取所有节点值

我有以下XML:

<tcm:Component ID="tcm:481-636667" IsEditable="false" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
  <tcm:Context>
    <tcm:Publication xlink:type="simple" xlink:title="07 Internal Test Publication" xlink:href="tcm:0-481-1"/>
    <tcm:OrganizationalItem xlink:type="simple" xlink:title="System Resources" xlink:href="tcm:481-92640-2"/>
  </tcm:Context> 
  <tcm:Data>
    <tcm:Title>IBE - Skywards</tcm:Title>
    <tcm:Type>Normal</tcm:Type>
    <tcm:Schema xlink:type="simple" xlink:title="Resources" xlink:href="tcm:481-190471-8"/>
    <tcm:Content>
      <Resources xmlns="http://www.sdltridion.com/tridion/schemas">
        <Text>
          <Key>SKYRL_MBD</Key>
          <Value>Miles Breakdown</Value>
        </Text>
        <Text>
          <Key>ltSR_MB.Text</Key>
          <Value>View Miles Breakdown</Value>
        </Text>
        <Text>
          <Key>ltSR_HMB.Text</Key>
          <Value>Hide Miles Breakdown</Value>
        </Text>
        <Text>
          <Key>SKYRL_MBD_LK</Key>
          <Value>Miles Breakdown</Value>
        </Text>    
      </Resources>
    </tcm:Content>
    <tcm:Metadata>
      <Metadata xmlns="http://www.sdltridion.com/tridion/schemas">
        <Language>
          <Language>English</Language>
        </Language>
      </Metadata>
    </tcm:Metadata>  
  </tcm:Data>
</tcm:Component>
Run Code Online (Sandbox Code Playgroud)

现在我想在C#中编写一个方法,它将此XML作为输入,并将返回List中的所有"Key"和"Value"数据.

请建议.

.net c# xml xpath .net-2.0

2
推荐指数
1
解决办法
8768
查看次数

使用TCMUploadAssembly.exe时出错

你能否告诉我为什么我得到以下错误,当我尝试使用TCMUploadAssembly.exe上传我的程序集时,下面是我在POST Build事件中完成的设置.

$(ProjectDir)Dependencies\TcmUploadAssembly.exe $(ProjectDir)Dependencies\config.xml $(TargetPath) /folder:tcm:226-92873-2
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

Error 1 The command "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\TridionTemplating\Tridion.BuildingBlocks\Dependencies\TcmUploadAssembly.exe C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\TridionTemplating\Tridion.BuildingBlocks\Dependencies\config.xml C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\TridionTemplating\Tridion.BuildingBlocks\bin\Debug\Tridion.BuildingBlocks.dll /folder:tcm:226-92873-2" exited with code 9009.

谢谢

tridion

2
推荐指数
1
解决办法
873
查看次数

如何在C#2.0中使用XSLT转换XMLDocument

我正在使用C#2.0,我有以下代码:

  XmlDocument doc = new XmlDocument();
  doc.LoadXml(GetListOfPagesInStructureGroup(m_Page.Id));
Run Code Online (Sandbox Code Playgroud)

在上面我使用以字符串形式返回的方法加载我的XMLDocument,现在在上面的xmldocument上进行一些处理后,我想在上面的XMLDocument上应用XSLT来根据XSLT呈现我想要的结果,最后我的函数将整个呈现的XML作为字符串返回

请建议!!

.net c# xml xslt

2
推荐指数
1
解决办法
9905
查看次数

我们可以使用.NET自定义Deployer吗?

我出于某些原因需要自定义我的部署程序,我只能看到一些使用java进行自定义部署的文章.

我们可以使用.NET项目自定义部署者,请分享您的想法,如果可能的话,一些解决方案.

.net tridion tridion2009 tridion-content-delivery

2
推荐指数
2
解决办法
535
查看次数

无法在自定义部署程序扩展代码中读取Tridion自定义config xml文件节点值

我的下面的代码在Tridion 2009中运行良好,最近我们迁移到了Tridion 2011,下面是用java编写的代码.

获取文件: ExtensionsConfiguration.java

package com.tridion.custom.extensions;

import com.tridion.configuration.Configuration;
import com.tridion.configuration.ConfigurationException;
import com.tridion.configuration.XMLConfigurationReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ExtensionsConfiguration
{
  private static Logger logger = LoggerFactory.getLogger(ExtensionsConfiguration.class);
  private static Configuration configuration;


  public static Configuration getInstance()
  {
    if (configuration == null)
      try
      {
        XMLConfigurationReader localXMLConfigurationReader = new XMLConfigurationReader();
        configuration = localXMLConfigurationReader.readConfiguration("cd_deployer_ext.xml");
        logger.info("ExtensionsConfiguration.getInstance:File Read",configuration.getContent());
      }
      catch (ConfigurationException localConfigurationException)
      {
        logger.error("ExtensionsConfiguration.ConfigurationException: Unable to read configuration.", localConfigurationException);
      }
      catch (Exception ex)
      {
        logger.error("ExtensionsConfiguration.Exception: Unable to read configuration.", ex.getStackTrace());
      }
    return configuration;
  }

}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我试图读取位于%TRIDION_HOME%/ …

java tridion tridion-content-delivery tridion-2011

2
推荐指数
1
解决办法
381
查看次数

如何在Component Presentation存储扩展中获取Component对象

我正在尝试在Tridion 2011中编写存储扩展,我将在其中进行扩展JPAComponentPresentationDAO和实现ComponentPresentationDAO.

public void create(ComponentPresentation itemToCreate, ComponentPresentationTypeEnum componentPresentationType) throws StorageException 
{
    super.create(itemToCreate,componentPresentationType);   
    String tcmURI = Integer.toString(itemToCreate.getComponentId());
    Component compObject // I want Component object to get the schema ID 
    PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction");
    PublishAction publishAction = new PublishAction();
    publishAction.setAction("ADD"); 
    publishAction.setTcmUri(tcmURI);
    publishActionDAO.store(publishAction);
}
Run Code Online (Sandbox Code Playgroud)

在上面的示例代码中,我想itemToCreate.getComponentId()在我获取组件ID的地方使用Component对象,这样我就可以将一些有用的细节传递给我的实体类,该实体类将该数据存储在我的数据库表中.

java tridion tridion-content-delivery tridion-2011 tridion-storage-extension

2
推荐指数
1
解决办法
339
查看次数