小编Dav*_*ecz的帖子

验证ItemsControl中的项目

我正在开发一个WPF应用程序,在一个窗口中我使用了WPF工具包中的向导组件.在这个向导中,我正在创建一个新人.在第二步中,我使用枚举作为可能的联系类型的来源(例如电话,电子邮件......).

这是我在XAML中的向导页面:

<xctk:WizardPage x:Name="NewContactPage" PageType="Interior"
                Title="Contacts" Style="{DynamicResource NewContactPage}"
                CanCancel="True" CanFinish="False"
                Loaded="NewContactPage_Loaded" 
                PreviousPage="{Binding ElementName=NewPersonPage}">
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
        <control:DataLoader x:Name="ctrNewContactLoader" />
        <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top" Orientation="Vertical">
            <ItemsControl ItemsSource="{Binding Path=Person.PersonContacts, Mode=TwoWay,
                                                            RelativeSource={RelativeSource Mode=FindAncestor,
                                                                                           AncestorType=Window}}"
                                      Name="icContacts">
                <ItemsControl.ItemTemplate>
                    <ItemContainerTemplate>
                        <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top" Orientation="Vertical"


                        Margin="5" Background="WhiteSmoke">
                        <CheckBox IsChecked="{Binding Path=IsValid}" 
                                              Content="{Binding Path=ContactType.Description}"
                                              Name="cbContactVisible"/>

                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top"
                                          Visibility="{Binding ElementName=cbContactVisible, Path=IsChecked, 
                                                               Converter={StaticResource BooleanToVisibilityConverter}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>

                            <TextBox Grid.Row="0" Grid.Column="0"
                                                 HorizontalAlignment="Stretch" MaxLength="64"
                                                 Name="txtContactValue"
                                                 Text="{Binding Path=Contact,
                                                        ValidatesOnDataErrors=True,
                                                        ValidatesOnNotifyDataErrors=True,
                                                        ValidatesOnExceptions=True}" />
                        </Grid>
                    </StackPanel>
                </ItemContainerTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl> …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml

6
推荐指数
1
解决办法
635
查看次数

IFrame OnReadyStateChange函数

我有一个asp.webforms应用程序,在页面ai有一个隐藏的div与progressbar和iframe.对于iframe我尝试从同一域上的另一个应用程序加载表单.

<div id="pagePreview" style="display: none;">
            <div class="progressBarWrapper" id="waitDialog" style="opacity:1;filter:alpha(opacity=100);display:none;">
                <div class="progressBarDetail" style="margin-top:25%;">
                    <asp:Image ID="imgLoading" runat="server" ImageUrl="~/Images/wait.gif" />
                </div>
            </div>
            <iframe id="previewContent" onreadystatechange="iframeLoaded(this);"></iframe>
        </div>
Run Code Online (Sandbox Code Playgroud)

在单击事件上,我调用一个函数在jqueryUI对话框中显示此div,我想显示进度条,直到iframe中的页面未加载.

var isClickedForDialog = false;

function iframeLoaded(args) {
            if (args.readyState == "complete" && isClickedForDialog) {
                var pagePreview = $('#pagePreview'); // dialog
                var waitDialog = $('#waitDialog'); // progress

                waitDialog.hide();

                isClickedForDialog = false;
            }
        }

function showModalWindow(url, hideCloseButton) {
            isClickedForDialog = true;

            var previewContent = $('#previewContent'); // Iframe
            var pagePreview = $('#pagePreview'); // dialog
            var waitDialog = $('#waitDialog'); // …
Run Code Online (Sandbox Code Playgroud)

javascript browser asp.net jquery

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

到 Postgres 的连接字符串

我是 Postgres 的新手,我需要连接字符串方面的帮助。

我的应用程序使用实体框架。我有这个连接到 MSSQL 服务器的连接字符串:

<connectionStrings>
    <add name="DBContext" connectionString="Data Source=localhost;Initial Catalog=DB;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)

在我的项目中,我下载了一个 npgsql 包(http://pgfoundry.org/projects/npgsql/),需要帮助编辑到 Postgres 数据库的连接字符串。

如何将 providerName 设置为 npgsql?

感谢帮助

postgresql entity-framework app-config npgsql

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

由JQuery重定向到另一个页面

我在我的网站上使用了jquery-1.8.0.min.js,我需要在某些情况下进行重定向.

我试过这个:

$('<div></div>').appendTo('body')
    .html('<div><h4>Some text....</h4></div>')
    .dialog({
        modal: true,
        title: 'Dialog title...',
        zIndex: 10000,
        autoOpen: true,
        width: 'auto',
        resizable: false,
        draggable: false,
        buttons: {
            Ok: function () {
                $(this).dialog("close");
                var loc = window.location;
                var currentURL = loc.protocol + '//' + loc.host + loc.pathname;

                var newUrl = loc.protocol + '//' + loc.host + 'Account/LogOn?ReturnUrl=' + urlencode(currentURL);
                $('<div style="dispaly:none;"></div>').appendTo('<body>').html('<a id="loginredirect" href="' + newUrl + ' "><br /></a>');
                $('#loginredirect').click();
            }
        },
        close: function (event, ui) {
            $(this).remove();
        }
    });
Run Code Online (Sandbox Code Playgroud)

但这不起作用:-(所以我试试这个:

$('<div></div>').appendTo('body')
    .html('<div><h4>Some text....</h4></div>')
    .dialog({ …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

0
推荐指数
1
解决办法
1305
查看次数