PDA

View Full Version : از کار افتادن کنترلها در هنگام استفاده از ajax



armangara
چهارشنبه 08 آبان 1387, 12:59 عصر
سلام دوستان
من یه یوزر کنترل دارم که می خواهم از آجاکس استفاده کنم. اما وقتی اطلاعات رو داخل updatepanel قرار می دهم postback همه کنترلها غیر فعال میشه.
من نمونه همین رو در یوزر کنرل ذیگری استفاده کردم و مشکلی نداره.

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ReqCode_1l.ascx.vb" Inherits="fa_customer_code_ReqCode_1l" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<style type="text/css">
.multi
{
font-family: Tahoma;
font-size: x-small;
}
.textbox
{
font-family: Tahoma;
font-size: x-small;
}
.input
{
font-size: x-small;
margin-top: 4px;
margin-right: 7px;
}
.style2
{
text-align: left;
font-size: x-small;
}
.style1
{
width: 648px;
height: 482px;
margin-right: 0px;
}
</style>
<body>
<div style="width: 655px; "
dir="rtl">

<asp:Panel ID="Panel1" runat="server" GroupingText="درخواست کد" Height="448px"
style="direction: rtl; background-color: #FFFFFF;" Width="652px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table align="center" class="style1" dir="rtl">
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:constr %>"



SelectCommand="SELECT station.ename, station.Id FROM station INNER JOIN Destination ON station.Id = Destination.City WHERE (station.countryId = @countryId) ORDER BY station.ename">
<SelectParameters>
<asp:ControlParameter ControlID="masir" Name="countryId"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:constr %>"
SelectCommand="SELECT [Id], [ename] FROM [Country] ORDER BY [Id]">
</asp:SqlDataSource>
</td>
<td>
<asp:SqlDataSource ID="SqlDataSource5" runat="server"
ConnectionString="<%$ ConnectionStrings:constr %>"
SelectCommand="SELECT DISTINCT [c_mabda] FROM [Destination]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:constr %>"

SelectCommand="SELECT [Id], [ename] FROM [startstation] WHERE ([CountryId] = @CountryId) ORDER BY [ename]">
<SelectParameters>
<asp:ControlParameter ControlID="cmbDes" Name="CountryId"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td colspan="2">
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:constr %>"




SelectCommand="SELECT distinct station.ename, Destination.marz FROM station INNER JOIN Destination ON station.Id = Destination.marz WHERE (station.countryId = @countryId) AND (station.type = @type and destination.city=@city)">
<SelectParameters>
<asp:ControlParameter ControlID="masir" Name="countryId"
PropertyName="SelectedValue" Type="Int32" />
<asp:Parameter DefaultValue="T" Name="type" Type="String" />
<asp:ControlParameter ControlID="cmbDes2" Name="city"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label25" runat="server" Font-Names="Tahoma" Font-Size="Small"
style="font-size: small" Text="مبدا :"></asp:Label>
</td>
<td>
<asp:Label ID="Label32" runat="server"
style="font-family: Tahoma; font-size: small" Text="کشور : "></asp:Label>
</td>
<td>
<asp:DropDownList ID="cmbDes" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="ename" DataValueField="Id"
Font-Names="Tahoma" Height="28px" style="margin-top: 0px" Width="129px">
</asp:DropDownList>
</td>
<td>
<asp:Label ID="Label34" runat="server"
style="font-family: Tahoma; font-size: small; text-align: center;" Text="شهر :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cmbDes1" runat="server" AutoPostBack="True"
CssClass="input" DataSourceID="SqlDataSource4" DataTextField="ename"
DataValueField="Id" Font-Names="Tahoma" Height="37px" Width="138px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label26" runat="server" Font-Names="Tahoma" Font-Size="Small"
style="font-size: small" Text="مقصد: "></asp:Label>
</td>
<td>
<asp:Label ID="Label33" runat="server"
style="font-family: Tahoma; font-size: small" Text="کشور : "></asp:Label>
</td>
<td>
<asp:DropDownList ID="masir" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="ename" DataValueField="Id"
Height="24px"
style="margin-right: 0px; font-family: Tahoma; margin-top: 0px;"
Width="127px">
</asp:DropDownList>
</td>
<td>
<asp:Label ID="Label35" runat="server"
style="font-family: Tahoma; font-size: small; text-align: center;" Text="شهر :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cmbDes2" runat="server" AutoPostBack="True"
CssClass="input" DataSourceID="SqlDataSource2" DataTextField="ename"
DataValueField="Id" Font-Names="Tahoma" Height="36px" Width="138px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" GroupName="ش"
style="font-family: Tahoma; font-size: x-small" Text="با مقصد" />
</td>
<td>
<asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" GroupName="ش"
style="font-family: Tahoma; font-size: x-small" TabIndex="1"
Text="بدون مقصد" />
</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:Label ID="Label20" runat="server"
style="font-family: Tahoma; font-size: xx-small; font-weight: 700; color: #663300"
Text="Label" Visible="False"></asp:Label>
</td>
<td>
<asp:Label ID="Label19" runat="server"
style="font-family: Tahoma; font-size: x-small" Text=" مرز:"
Visible="False"></asp:Label>
</td>
<td colspan="2">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource3" DataTextField="ename" DataValueField="marz"
Visible="False" style="font-family: Tahoma" Width="150px">
</asp:DropDownList>
</td>
</tr>

<tr>
<td class="style2">

نوع واگن:&nbsp;</td>
<td>

<asp:RadioButton ID="mosaghaf" runat="server" Checked="True"
Font-Names="Tahoma" Font-Size="Small" Text="مسقف" GroupName="wagon"
AutoPostBack="True" />
</td>
<td>
<asp:RadioButton ID="makhzani" runat="server" Font-Names="Tahoma"
Font-Size="Small" Text="مخزنی" GroupName="wagon" AutoPostBack="True" />
</td>
<td colspan="2">
<asp:RadioButton ID="continery" runat="server" AutoPostBack="True"
Font-Names="Tahoma" Font-Size="Small" Text="کانتینری" GroupName="wagon" />
</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
<asp:RadioButton ID="bifoot" runat="server" Font-Names="Tahoma"
Font-Size="Small" Text="20foot" Visible="False" GroupName="continer" />
</td>
<td>
<asp:RadioButton ID="chfoot" runat="server" Font-Names="Tahoma"
Font-Size="Small" Text="40 foot" Visible="False" GroupName="continer" />
</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label27" runat="server" Font-Names="Tahoma" Font-Size="Small"
style="font-size: x-small" Text="تناژ :"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtTonag" runat="server" CssClass="textbox" Height="23px"
Width="56px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ControlToValidate="txtTonag" ErrorMessage="*" SetFocusOnError="True"
Width="16px"></asp:RequiredFieldValidator>
</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>

<tr>
<td class="style2">
<asp:Label ID="Label2" runat="server" Font-Names="Tahoma" Font-Size="Small"
style="font-size: x-small" Text="شماره واگن:"></asp:Label>
</td>
<td>
<asp:TextBox ID="wagonno" runat="server" CssClass="textbox" Height="23px"
Width="127px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="wagonno" ErrorMessage="*" SetFocusOnError="True"
Width="16px"></asp:RequiredFieldValidator>
</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label28" runat="server" Font-Names="Tahoma"
style="font-size: x-small" Text="تاریخ :" Font-Size="Small"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="127px"></asp:TextBox>
<cc1:CalendarExtender ID="TextBox1_CalendarExtender" runat="server"
Enabled="True" TargetControlID="TextBox1">
</cc1:CalendarExtender>
</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label1" runat="server" Font-Names="Tahoma"
style="font-size: x-small" Text="کالا"></asp:Label>
</td>
<td colspan="4">
<asp:TextBox ID="kala" runat="server" Font-Names="Tahoma" Font-Size="Small"></asp:TextBox>
&nbsp;
<asp:Button ID="Button1" runat="server" Text="اضافه کن" Width="50px"
Font-Names="Tahoma" Font-Size="XX-Small" />
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="Label31" runat="server" Font-Names="Tahoma"
style="font-size: x-small" Text="شرح كالا"></asp:Label>
</td>
<td colspan="4">
<asp:TextBox ID="txtDesc" runat="server" CssClass="multi" Height="66px"
TextMode="MultiLine" Width="540px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2" colspan="2">
آیا&nbsp; </td>
<td colspan="3">
&nbsp;
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
RepeatDirection="Horizontal" RepeatLayout="Flow" style="font-size: xx-small">
<asp:ListItem Selected="True" Value="1">بله
</asp:ListItem>
<asp:ListItem Value="0">خیر</asp:ListItem>
</asp:RadioButtonList>
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
</td>
<td align="center" colspan="2">
<asp:Label ID="lblErr0" runat="server" Font-Names="Tahoma" Font-Size="X-Small"
ForeColor="Red" style="text-align: center" Visible="False">شماره واگن باید 8
رقمی باشد.</asp:Label>
</td>
<td colspan="2">
</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td style="text-align: left">
<asp:Button ID="btnGo" runat="server" CssClass="input" Font-Names="Tahoma"
Font-Size="X-Small" Height="20px" Text="ثبت" Visible="true" Width="104px" />
</td>
<td>
<asp:Button ID="btnGo0" runat="server" CssClass="input" Font-Names="Tahoma"
Font-Size="X-Small" Text="انصراف" Visible="true" Width="90px"
CausesValidation="False" PostBackUrl="~/fa/customer/mainpage.aspx" />
</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="style2">
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
</table> </ContentTemplate></asp:UpdatePanel>
</asp:Panel>

</div>
</body>
]