TextBox validation is empty or 11 digits - c#

I have a textbox in my form which must be validated only if is empty or contains 11 digits.
I tried every solution found on internet but nothing happens.
<script type="text/javascript">
$(document).ready(function() {
$('#ctl00_CPH1_tax_id').attr("placeholder", "1234567890");
$('#ctl00_CPH1_citizen_id').attr("placeholder", "12345678901");
$('#ctl00_CPH1_e_posta').attr("placeholder", "ahmet.mehmet#sirket.com.tr");
//var isbp = $('#ctl00_CPH1_IsBP');
var name = $('#ctl00_CPH1_name').val();
var code = $('#ctl00_CPH1_code').val();
var dropdownlist2 = $('select:first');
var tax_id = $('#ctl00_CPH1_tax_id').val();
var citizen_id = $('#ctl00_CPH1_citizen_id').val();
var email1 = $('#ctl00_CPH1_e_posta').val();
var isbp = $('input[type=checkbox]:first');
var dropdownlist1 = $('select:last');
var isactive = $('input[type=checkbox]:last');
//var dropdownlist1 = $('#ct100_CPH1_DropDownList1');
var tax_id_check = /^\d{10}$/.test(tax_id);
var citizen_id_check = /^$|^\d{11}$/.test(citizen_id);
var email1_check = /^[a-zA-Z0-9._]+#([a-zA-Z0-9.]|[a-zA-Z0-9]+\-[a-zA-Z0-9.])+\.[a-zA-Z]{2,6}$/.test(email1);
dropdownlist1.attr("disabled", "disabled");
isactive.attr("disabled", "disabled");
$(isbp).click(function(e) {
if (isbp.is(':checked')) {
dropdownlist1.removeAttr("disabled");
isactive.removeAttr("disabled");
}
else {
isactive.attr("disabled", "disabled");
dropdownlist1.attr("disabled", "disabled");
}
});
$("#ctl00_CPH1_Button1").click(function(e) {
//console.log(drop2);
//var name_status = /^[a-zA-Z][a-zA-Z]*$/.test(name);
//var code_status = /^[a-zA-Z][a-zA-Z]*$/.test(code);
//var IsBP = $('#ctl00_CPH1_IsBP');
//if (name.length < 3 || name_status == false) {
// e.preventDefault();
// alert('İsim sadece karakterlerden oluşmalı ve en az iki karakter olmalı!');
//}
//if (code.length < 3 || code_status == false) {
// e.preventDefault();
// alert('Soyisim sadece karakterlerden oluşmalı ve en az iki karakter olmalı!');
//}
if (name.length == 0) {
e.preventDefault();
alert("İsim girilmedi!");
}
if (code.length == 0) {
e.preventDefault();
alert("Şirket Kodu girilmedi!");
}
if (dropdownlist2.val() == 0) {
e.preventDefault();
alert("Ülke seçilmedi!");
}
if (citizen_id.length != 0) {
e.preventDefault();
alert("Vatandaşlık numarası onbir haneli olmalı!");
}
if (tax_id.length == 0) {
e.preventDefault();
alert("Vergi numarası girilmedi!");
}
else if (!tax_id_check) {
e.preventDefault();
alert("Vergi numarası on haneli olmalı!");
}
if (email1 != "" && !email1_check) {
e.preventDefault();
alert("E-Posta geçerli değil!");
}
if (isbp.is(':checked') && dropdownlist1.val() == 0) {
e.preventDefault();
alert("İş ortağı tipi seçilmedi!");
}
});
});
This is my script and aspx follows:
<form id="form1" runat="server">
<div>
<center>
<table>
<tr>
<td colspan="3" align="center">
Şirket Giriş Ekranı</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label1" runat="server" Text="İsim"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="name" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label2" runat="server" Text="Şirket Kodu"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="code" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label3" runat="server" Text="Ülke"></asp:Label>
</td>
<td class="style4" colspan="2">
<asp:DropDownList ID="DropDownList2" runat="server"
onselectedindexchanged="DropDownList2_SelectedIndexChanged">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label4" runat="server" Text="Vergi No"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="tax_id" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label5" runat="server" Text="Vergi Dairesi"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="tax_office" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label6" runat="server" Text="Vatandaşlık No"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="citizen_id" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label7" runat="server" Text="Adres"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="address" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label14" runat="server" Text="E-posta"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="e_posta" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label15" runat="server" Text="Telefon"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="telefon" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label16" runat="server" Text="Fax"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="faks" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label10" runat="server" Text="İş Ortağım"></asp:Label>
</td>
<td colspan="2">
<asp:CheckBox ID="IsBP" runat="server" oncheckedchanged="IsBP_CheckedChanged"/> <!--AutoPostBack="true"-->
<asp:Label ID="Label11" runat="server" Text="Evet"></asp:Label>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label12" runat="server" Text="İş Ortağı Tipi"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:CheckBox ID="IsActive" runat="server"
oncheckedchanged="IsActive_CheckedChanged" />
<asp:Label ID="Label13" runat="server" Text="Aktif"></asp:Label>
</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Geri" />
</td>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Kaydet" />
</td>
</tr>
</table>
<br />
</center>
</div>
</form>
I tried jquery older versions like 1.8.3 which is stable instead of 1.9.1
Also jquery.validate.
When I run the code on chrome and inspect element on console everything runs properly.
But my code does not show any alerts.
"==" works but "!=" or ">" not.
Thanks in advance!
not working textboxes are e_mail and citizen_id. other textboxes work properly.

Use the ASP.NET validator with a regular expression akin to
"(\d{11})?"
<asp:RegularExpressionValidator ControlToValidate="citizen_id"
ValidationExpression="(\d{11})?" runat="server"
Text="Must be 11 digits or empty" />
This will prevent a postback if the textbox "citizen_id" is anything but "" or an 11 digit number.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.regularexpressionvalidator.aspx

Related

C# = The ListView raised event which wasn't handled.

There is a ListView which shows the data that were retrieved from the database.
I want to edit a single record on a ListView by clicking the edit button beside it but if I press the edit button, I get the error:
The ListView 'lvItemView' raised event ItemEditing which wasn't handled.
Here is the ListView:
<asp:ListView ID="lvItemView" runat="server" ItemPlaceholderID="itemHolder">
<LayoutTemplate>
<table style="color: Black;" width="100%" border="0" cellpadding="5">
<tr>
<th style="text-align: center;">Customer ID</th>
<th style="text-align: center;">Contact Name</th>
<th style="text-align: center;">Company</th>
<th style="text-align: center;">Created By</th>
<th style="text-align: center;">Created Date</th>
<th style="text-align: center;">Modified By</th>
<th style="text-align: center;">Modified Date</th>
</tr>
<asp:PlaceHolder ID="itemHolder" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td align="left">
<asp:Label ID="lblCustomerID" runat="Server" Text='<%#Eval("_CustomerID") %>' />
</td>
<td align="left">
<asp:Label ID="lblContactName" runat="Server" Text='<%#Eval("_ContactName") %>' />
</td>
<td align="left">
<asp:Label ID="lblCompany" runat="Server" Text='<%#Eval("_CompanyID") %>' />
</td>
<td align="left">
<asp:Label ID="lblCreatedBy" runat="Server" Text='<%#Eval("_CreatedBy") %>' />
</td>
<td align="left">
<asp:Label ID="lblCreatedDate" runat="Server" Text='<%#Eval("_CreatedDate") %>' />
</td>
<td align="left">
<asp:Label ID="lblModifiedBy" runat="Server" Text='<%#Eval("_ModifiedBy") %>' />
</td>
<td align="left">
<asp:Label ID="lblModifiedDate" runat="Server" Text='<%#Eval("_ModifiedDate") %>' />
</td>
<td align="left">
<asp:LinkButton ID="EditButton" runat="Server" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container, "DataItemIndex")%>' />
</td>
<td align="left">
<asp:LinkButton ID="Delete" runat="Server" Text="Delete" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container, "DataItemIndex")%>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
And the code behind
protected void lvItemView_ItemEditing(object sender, ListViewEditEventArgs e)
{
System.Web.UI.WebControls.Label index_id = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblCustomerID");
int customerID = int.Parse(index_id.Text);
Item item = new Item();
item._CustomerID = customerID;
System.Web.UI.WebControls.Label cmp_id = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblCompany");
int companyID = int.Parse(cmp_id.Text);
item._CompanyID = companyID;
System.Web.UI.WebControls.Label samp = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblContactName");
item._ContactName = samp.Text;
samp = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblCreatedBy");
item._CreatedBy = samp.Text;
samp = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblCreatedDate");
item._CreatedDate = samp.Text;
samp = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblModifiedBy");
item._ModifiedBy = samp.Text;
samp = (System.Web.UI.WebControls.Label)lvItemView.Items[e.NewEditIndex].FindControl("lblModifiedDate");
item._ModifiedDate = samp.Text;
CustomerID = item._CustomerID.ToString();
ContactName = item._ContactName.ToString();
CompanyID = item._CompanyID.ToString();
CreatedBy = item._CreatedBy.ToString();
CreatedDate = item._CreatedDate.ToString();
ModifiedBy = item._ModifiedBy.ToString();
ModifiedDate = item._ModifiedDate.ToString();
modAdd.Show();
}
I am new to asp.net and c# so I have no idea what to do with this kind of error.
set the event lvItemView_ItemEditing in OnItemEditing which will be triggered when click on edit button
<asp:ListView ID="lvItemView" runat="server" ItemPlaceholderID="itemHolder" OnItemEditing="lvItemView_ItemEditing">
and also set data source if you are binding on pageload
lvItemView.DataSource = SomeData;
lvItemView.DataBind();

Telerik RadGrid - Not giving new value in the UpdateCommand event handler

The problem i am facing is in this line.
decimal amount = Convert.ToDecimal(Amt.Text);
Amt.Text is not giving me the new entered value when i change it and try to save it. But it is giving me the old value. I don't know why ? Please suggest the fix.
I have a search button also in the webpage which is needed to rebind the Grid with the latest data. I think when i click the save link and gvLineItems_UpdateCommand is called , the rebinding is happening before that on the RADGRID (internally).
ASPX Code:-
<asp:content id="Content2" contentplaceholderid="MainContent" runat="server">
<script language="javascript">
function captureVal(sender, args){
alert('hi');
}
</script>
<table>
<tr>
<td>
<asp:Label ID="lblPartnerID" runat="server" Text="PartnerID" Font-Bold="true"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="tbPartnerID" runat="server" MaxLength="35" Width="243px" />
</td>
<td>
<asp:Button ID="btnSearch" runat="server" Width="80px" Visible="true" Text="Search" />
</td>
</tr>
<tr>
<td style="text-align:right">
<asp:Button ID="btnSave" runat="server" Visible="true" Text="Save" />
</td>
<td style="text-align:left">
<asp:Button ID="btnCancel" runat="server" Visible="true" Text="Cancel" />
</td>
</tr>
<tr>
<td>
Partner SSN/TIN:
</td>
<td>
<telerik:RadTextBox ID="tbPartnerEIN" runat="server" MaxLength="9" TabIndex="5">
</telerik:RadTextBox>
<label id="Label1" runat="Server" style="color: Navy">* No Dashes</label>
</td>
<td style="width:10px"></td>
<td style="text-align:left">
Address Line 1:
</td>
<td>
<telerik:RadTextBox ID="tbAddressLine1" runat="server" TabIndex="10" />
<label id="label2" runat="server" style="color: navy">
* No dashes</label>
</td>
</tr>
<tr>
<td>
Custodial EIN:
</td>
<td>
<telerik:RadTextBox ID="tbCustodialEIN" runat="server" MaxLength="9" TabIndex="10">
</telerik:RadTextBox>
<label id="Label3" runat="Server" style="color: Navy">* No Dashes</label>
</td>
<td style="width:10px"></td>
<td style="text-align:left">
Address Line 2:
</td>
<td>
<telerik:RadTextBox ID="tbAddressLine2" runat="server" TabIndex="10" />
<label id="Label4" runat="Server" style="color: Navy">
* No Dashes</label>
</td>
</tr>
<tr>
<td>
Format SSN/TIN:
</td>
<td>
<telerik:RadComboBox ID="cboFormatSSNTIN" Height="200px" runat="server" Width="246px"
TabIndex="41">
<Items>
<telerik:RadComboBoxItem Text="" Value="" />
<telerik:RadComboBoxItem Text="XXX-XX-XXXX" Value="0" />
<telerik:RadComboBoxItem Text="XX-XXXXXXX" Value="1" />
</Items>
</telerik:RadComboBox>
</td>
<td style="width:10px"></td>
<td style="text-align:left">
City:
</td>
<td>
<telerik:RadTextBox ID="tbCity" runat="server" MaxLength="22" Width="243px" TabIndex="45" />
</td>
</tr>
<tr>
<td>
Partner Name 1:
</td>
<td>
<telerik:RadTextBox ID="tbPartnerName1" runat="server" MaxLength="35" Width="243px"
TabIndex="15" />
</td>
<td style="width:10px"></td>
<td style="text-align:left">
State:
</td>
<td>
<telerik:RadComboBox ID="ddlState" runat="server" AllowCustomText="true" Filter="Contains"
Width="243px" TabIndex="35" Height="100" />
</td>
</tr>
<tr>
<td>
Partner Name 2:
</td>
<td>
<telerik:RadTextBox ID="tbPartnerName2" runat="server" MaxLength="35" Width="243px"
TabIndex="20" />
</td>
<td style="width:10px"></td>
<td style="text-align:left">
Zip:
</td>
<td>
<telerik:RadTextBox ID="tbZipcode" runat="server" MaxLength="12" Width="243px" TabIndex="55" />
</td>
</tr>
<tr>
<td>
Entity Type:
</td>
<td>
<telerik:RadComboBox ID="lbEntityType" Height="150px" runat="server" Width="246px"
TabIndex="40" />
<asp:RequiredFieldValidator ID="Requiredfieldvalidator1" runat="server" ErrorMessage="Select any one Entity type"
ControlToValidate="lbEntityType" InitialValue="0" Display="None">*</asp:RequiredFieldValidator>
</td>
<td style="width:10px"></td>
<td style="text-align:left">
Foreign Address:
</td>
<td>
<telerik:RadTextBox ID="tbForeignAddress" runat="server" Width="243px" TabIndex="35" />
</td>
</tr>
<tr>
<td colspan="2">
</td>
<td style="width:10px"></td>
<td style="text-align:left">
Domestic or Foreign:
</td>
<td>
<telerik:RadComboBox ID="lbCountry" runat="server" Width="246px" TabIndex="35" />
</td>
</tr>
<tr>
<td>
<asp:RadioButtonList ID="rbFinalAmend" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>Final K-1</asp:ListItem>
<asp:ListItem>Amended K-1</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td colspan="2">
<asp:RadioButtonList ID="rbGenLtd" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>General partner or LLC member-manager</asp:ListItem>
<asp:ListItem>Limited partner or other LLC member</asp:ListItem>
</asp:RadioButtonList>
</td>
<td style="width:10px"></td>
<td>
Nonrecourse
</td>
<td>
$<telerik:RadNumericTextBox ID="txtNonrecourse" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<br />
<asp:CheckBox ID="cbTax" Text="Tax basis" runat="server" />
<asp:CheckBox ID="cbGaap" Text="GAAP" runat="server" />
<asp:CheckBox ID="cbSection" Text="Section 704(b) book" runat="server" />
</td>
<td style="width:10px"></td>
<td>
Qualified nonrecourse financing
</td>
<td>
$<telerik:RadNumericTextBox ID="txtQualified" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="cbOther" Text="Other(explain)" runat="server" />
</td>
<td style="width:10px"></td>
<td>
Recourse
</td>
<td>
$<telerik:RadNumericTextBox ID="txtRecourse" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server" />
</td>
</tr>
</table>
<table>
<tr>
<td colspan="3">
<br />
<span style="font-weight: bold; font-size: 10pt">(M) Did the partner contribute property
with a built-in gain or loss?</span>
<br />
<hr size="1" />
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:RadioButtonList ID="rbContributedProperty" runat="server" RepeatDirection="Horizontal">
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:RadioButtonList>
<br />
</td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<table>
<tr>
<td>
<table>
<thead colspan="2">
<span style="font-weight: bold; font-size: 10pt">(L) Partner's capital account analysis</span>
</thead>
<hr size="1" />
<br />
<br />
<tr>
<td>
Beginning capital account
</td>
<td>
$<telerik:RadNumericTextBox ID="txtCapBeginning" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>
Capital contributed during the year
</td>
<td>
$<telerik:RadNumericTextBox ID="txtCapContributed" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>
Current year increase(decrease)
</td>
<td>
$<telerik:RadNumericTextBox ID="txtIncrease" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>
Withdrawals & distributions <span style="color: Red">(-)</span>
</td>
<td>
$<telerik:RadNumericTextBox ID="txtWithdrawals" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" ForeColor="Red" runat="server">
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>
Ending capital account
</td>
<td>
$<telerik:RadNumericTextBox ID="txtCapEnding" DataType="System.Double" NumberFormat-DecimalDigits="2"
Width="200px" runat="server" ReadOnly="true" />
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
</td>
<td align="center">
<b> Beginning</b>
</td>
<td align="center">
<b>Ending</b>
</td>
</tr>
<tr>
<td>
Profit
</td>
<td>
<telerik:RadNumericTextBox ID="txtBeginningProfit" DataType="System.Double"
NumberFormat-DecimalDigits="6" Width="200px" runat="server" />%
</td>
<td>
<telerik:RadNumericTextBox ID="txtEndProfit" DataType="System.Double" NumberFormat-DecimalDigits="6"
Width="200px" runat="server" />%
</td>
</tr>
<tr>
<td>
Loss
</td>
<td>
<telerik:RadNumericTextBox ID="txtBeginningLoss" DataType="System.Double"
NumberFormat-DecimalDigits="6" Width="200px" runat="server" />%
</td>
<td>
<telerik:RadNumericTextBox ID="txtEndLoss" DataType="System.Double" NumberFormat-DecimalDigits="6"
Width="200px" runat="server" />%
</td>
</tr>
<tr>
<td>
Capital
</td>
<td>
<telerik:RadNumericTextBox ID="txtBeginningCap" DataType="System.Double"
NumberFormat-DecimalDigits="6" Width="200px" runat="server" />%
</td>
<td>
<telerik:RadNumericTextBox ID="txtEndCap" DataType="System.Double" NumberFormat-DecimalDigits="6"
Width="200px" runat="server" />%
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<telerik:RadGrid runat="server" ID="gvLineItems" AllowMultiRowSelection="true" AllowMultiRowEdit="False"
AllowAutomaticUpdates="false" AllowAutomaticInserts="false" Width="100%" AllowAutomaticDeletes="False" GridLines="None" Pagesize="10"
AllowPaging="True" AutoGenerateColumns="False" PagerStyle-Mode="NextPrevAndNumeric" OnNeedDataSource="gvLineItems_NeedDataSource">
<MasterTableView InsertItemDisplay="Bottom" AutoGenerateColumns="false" AllowAutomaticUpdates="false" EditMode="InPlace"
DataKeyNames="SchK1ID,LineNumber,LineCode,Amount"
AllowAutomaticDeletes="false" Width="100%" AllowAutomaticInserts="false" CommandItemDisplay="None">
<HeaderStyle HorizontalAlign="Left" Wrap="false" />
<ItemStyle HorizontalAlign="Left"/>
<Columns>
<telerik:GridBoundColumn HeaderText="Line Number" DataField="LineNumber" SortExpression="LineNumber" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ReadOnly="true" />
<telerik:GridBoundColumn HeaderText="Line Code" DataField="LineCode" SortExpression="LineCode" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ReadOnly="true" />
<telerik:GridBoundColumn HeaderText="Description" DataField="LineDescription" SortExpression="LineDescription" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ReadOnly="true" />
<telerik:GridTemplateColumn DataType="System.Decimal" HeaderText="Amount" DataField="Amount" SortExpression="Amount" UniqueName="Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top">
<ItemTemplate><%#Eval("Amount", "{0:c}")%></ItemTemplate>
<EditItemTemplate>
<telerik:RadNumericTextBox runat="server" id="tbAmount" width="75px" EmptyMessage="0" DataType="System.Decimal" Text='<%#Eval("Amount")%>' NumberFormat-DecimalDigits="3">
</telerik:RadNumericTextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn UniqueName="Save" ButtonType="LinkButton" EditText="Edit" InsertText="Insert" UpdateText="Save"/>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="True"/>
</ClientSettings>
</telerik:RadGrid>
</td>
</tr>
</table>
C# Code Behind:
public partial class EFileK1ImageEdit : System.Web.UI.Page
{
private string m_EFSTaxPayerID;
public int PartnerId {
get {
if (!string.Empty.Equals(tbPartnerID.Text.Trim())) {
return Convert.ToInt32(tbPartnerID.Text.Trim());
}
return 0;
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack) {
this.LoadPartner();
this.PopulateCapitalAccount();
}
}
public void LoadPartner()
{
if (!(PartnerId == 0)) {
Partner p = Partner.GetEfilePartnerByID(PartnerId, ProfileExtensions.GetCurrentYear(), ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
if ((p != null)) {
PopulateInfo(p, ProfileExtensions.GetCurrentYear());
}
}
}
public void PopulateDropDowns()
{
this.lbEntityType.DataSource = IDMS.BusinessObjects.EntityCode.GetEntityType(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
this.lbEntityType.DataTextField = "Explanation";
this.lbEntityType.DataValueField = "EntityCodeID";
this.lbEntityType.DataBind();
this.ddlState.DataSource = IDMS.BusinessObjects.SystemSettings.GetStateCodes(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
this.ddlState.DataTextField = "StateCode";
this.ddlState.DataValueField = "StateCode";
this.ddlState.DataBind();
this.ddlState.Items.FindItemByText(". ").Text = "FR";
this.lbCountry.DataSource = IDMS.BusinessObjects.MailCode.GetAllMailCodes(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
this.lbCountry.DataTextField = "Explanation";
this.lbCountry.DataValueField = "MailCodeID";
this.lbCountry.DataBind();
}
private void SetStateControl(string value)
{
RadComboBoxItem item = this.ddlState.FindItemByValue(value);
if (item == null) {
this.ddlState.Text = value;
} else {
item.Selected = true;
}
if (value.Trim() == ".") {
this.ddlState.Text = "";
}
}
protected void PopulateInfo(Partner p, int taxYear)
{
PopulateDropDowns();
this.tbPartnerID.Text = this.PartnerId.ToString();
}
private void PopulateCapitalAccount()
{
IDMS.BusinessObjects.CapitalAccount ca = IDMS.BusinessObjects.CapitalAccount.GetEFileCapitalAccount(this.PartnerId, ProfileExtensions.GetCurrentYear(), ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
// SetManualAdjustmentMessage(ca)
if (ca != null) {
var _with1 = ca;
this.rbFinalAmend.Items[0].Selected = _with1.FinalK1;
this.rbFinalAmend.Items[1].Selected = _with1.AmendedK1;
this.rbGenLtd.Items[0].Selected = _with1.GeneralPartner;
this.rbGenLtd.Items[1].Selected = _with1.LimitedPartner;
this.txtBeginningCap.Value = _with1.BeginningCapitalPercent * 100;
this.txtBeginningLoss.Value = _with1.BeginningLossPercent * 100;
this.txtBeginningProfit.Value = _with1.BeginningProfitPercent * 100;
this.txtEndCap.Value = _with1.EndingCapitalPercent * 100;
this.txtEndLoss.Value = _with1.EndingLossPercent * 100;
this.txtEndProfit.Value = _with1.EndingProfitPercent * 100;
this.txtNonrecourse.Value = _with1.LiabilityShareNonRecourse;
this.txtQualified.Value = _with1.LiabilitySharedQualifiedNonRecourse;
this.txtRecourse.Value = _with1.LiabilitySharedRecourse;
} else {
this.rbContributedProperty.Items[0].Selected = false;
this.rbContributedProperty.Items[1].Selected = false;
}
}
protected void gvLineItems_UpdateCommand(object sender, GridCommandEventArgs eventData)
{
//Validate Parameters
if (eventData.Item is GridEditableItem && eventData.Item.IsInEditMode) {
DataTable dt = IDMS.BusinessObjects.EfileMapping.GetEFileLineItemsByPartner(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername(), ProfileExtensions.GetCurrentYear(), PartnerId);
//Declare Variables
GridEditableItem editableItem = eventData.Item as GridEditableItem;
int LineNumber = Convert.ToInt32(editableItem.GetDataKeyValue("LineNumber"));
string LineCode = Convert.ToString(editableItem.GetDataKeyValue("LineCode"));
decimal oldAmount = Convert.ToDecimal(dt.Select(string.Format("LineNumber={0} and LineCode='{1}'", LineNumber, LineCode))[0]["Amount"]);
RadNumericTextBox Amt = editableItem.FindControl("tbAmount") as RadNumericTextBox;
decimal amount = Convert.ToDecimal(Amt.Text);
decimal diff = amount - oldAmount;
txtIncrease.Text = (Convert.ToDecimal(txtIncrease.Text) + diff).ToString();
txtCapEnding.Text = (Convert.ToDecimal(txtCapEnding.Text) + diff).ToString();
saveCapitalAccount();
IDMS.BusinessObjects.EfileMapping.UpdateEFileLineItemsByPartner(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername(), ProfileExtensions.GetCurrentYear(), PartnerId, amount, LineNumber, LineCode);
}
}
protected void gvLineItems_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
gvLineItems.DataSource = IDMS.BusinessObjects.EfileMapping.GetEFileLineItemsByPartner(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername(), ProfileExtensions.GetCurrentYear(), PartnerId);
}
protected void btnSearch_Click(object sender, EventArgs e)
{
this.LoadPartner();
this.PopulateCapitalAccount();
gvLineItems.Rebind();
}
private void btnSave_Click(object sender, System.EventArgs e)
{
IDMS.BusinessObjects.Partner p = new IDMS.BusinessObjects.Partner();
var _with2 = p;
_with2.PartnerID = int.Parse(tbPartnerID.Text);
_with2.EFSNameLine1 = tbPartnerName1.Text;
UpdateEFileDetailPartnerGridByYear(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentYear(), this.PartnerId);
}
public void saveCapitalAccount()
{
IDMS.BusinessObjects.CapitalAccount ca = new IDMS.BusinessObjects.CapitalAccount();
var _with3 = ca;
_with3.PartnerID = this.PartnerId;
_with3.CalendarYear = ProfileExtensions.GetCurrentYear();
_with3.FinalK1 = this.rbFinalAmend.Items[0].Selected;
_with3.AmendedK1 = this.rbFinalAmend.Items[1].Selected;
_with3.GeneralPartner = this.rbGenLtd.Items[0].Selected;
_with3.LimitedPartner = this.rbGenLtd.Items[1].Selected;
_with3.BeginningCapitalPercent = this.txtBeginningCap.Value.GetValueOrDefault(0) / 100;
_with3.BeginningLossPercent = this.txtBeginningLoss.Value.GetValueOrDefault(0) / 100;
_with3.BeginningProfitPercent = this.txtBeginningProfit.Value.GetValueOrDefault(0) / 100;
_with3.EndingCapitalPercent = this.txtEndCap.Value.GetValueOrDefault(0) / 100;
_with3.EndingLossPercent = this.txtEndLoss.Value.GetValueOrDefault(0) / 100;
_with3.EndingProfitPercent = this.txtEndProfit.Value.GetValueOrDefault(0) / 100;
_with3.LiabilityShareNonRecourse = this.txtNonrecourse.Value.GetValueOrDefault(0);
_with3.LiabilitySharedQualifiedNonRecourse = this.txtQualified.Value.GetValueOrDefault(0);
_with3.LiabilitySharedRecourse = this.txtRecourse.Value.GetValueOrDefault(0);
_with3.AccountAnalysisBeginningCapital = this.txtCapBeginning.Value.GetValueOrDefault(0);
_with3.AccountAnalysisContributions = this.txtCapContributed.Value.GetValueOrDefault(0);
_with3.AccountAnalysisIncreaseDecrease = this.txtIncrease.Value.GetValueOrDefault(0);
_with3.AccountAnalysisWithdrawalsDistributions = this.txtWithdrawals.Value.GetValueOrDefault(0);
_with3.AccountAnalysisEndingCapital = _with3.AccountAnalysisBeginningCapital + _with3.AccountAnalysisContributions + _with3.AccountAnalysisIncreaseDecrease - _with3.AccountAnalysisWithdrawalsDistributions;
_with3.AccountAnalysisGAAP = this.cbGaap.Checked;
_with3.AccountAnalysisOther = this.cbOther.Checked;
_with3.AccountAnalysisSection704b = this.cbSection.Checked;
_with3.AccountAnalysisTaxBasis = this.cbTax.Checked;
_with3.ContributePropertyYes = this.rbContributedProperty.Items[0].Selected;
_with3.ContributePropertyNo = this.rbContributedProperty.Items[1].Selected;
_with3.SaveEfile(ProfileExtensions.GetCurrentClient(), ProfileExtensions.GetCurrentUsername());
}
public EFileK1ImageEdit()
{
Load += Page_Load;
Init +=EFileK1ImageEdit_Init;
}
private void EFileK1ImageEdit_Init(object sender, EventArgs e)
{
btnSave.Click+=btnSave_Click;
btnCancel.Click +=btnCancel_Click;
btnSearch.Click+=btnSearch_Click;
gvLineItems.NeedDataSource +=gvLineItems_NeedDataSource;
gvLineItems.UpdateCommand +=gvLineItems_UpdateCommand;
}
}

Can't get multiview control to change views

I have a multiview control, that has two views. View1 is the default view, and View2 is the new view. When the end user click a button, I want to change the view to View2. I can't seem to achieve this anyway I go.
ASP.NET Code:
<asp:MultiView ID="MVOrder" runat="server">
<asp:View ID="VOrderNow" runat="server">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<asp:Label ID="LblInfo" runat="server"></asp:Label>
</td>
<td>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="LblDrink" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="LblItemInfo" runat="server"></asp:Label>
</td>
<td>
</td>
<td> </td>
</tr>
</table>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:View>
<asp:View runat="server" ID="VOrderComplete">
<table class="auto-style1">
<tr>
<td> </td>
<td>
<asp:Label ID="LblOrderComplete" runat="server"></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<asp:Label ID="LblOrderNumberAgain" runat="server"></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<asp:Label ID="LblOrderTimeAgain" runat="server"></asp:Label>
</td>
<td> </td>
</tr>
</table>
</asp:View>
<br/>
</asp:MultiView>
Button Click Event Code:
protected void Button1_Click(object sender, EventArgs e)
{
//MVOrder.ActiveViewIndex = 1;
MVOrder.SetActiveView(VOrderComplete);
}
Page Load Code:
if (!IsPostBack)
{
MVOrder.SetActiveView(VOrderNow);
}
Can someone please tell me what I am doing wrong?
I think you might have some additional code that might make this not work properly. But based on what you've shown, this will post and update your view:
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:MultiView ID="MVOrder" runat="server">
<asp:View ID="VOrderNow" runat="server">
<table>
<tr>
<td><asp:Label ID="LblInfo" runat="server" Text="asdfasdfasdf"></asp:Label></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><asp:Label ID="LblDrink" runat="server" Text="lmnoplmnop"></asp:Label></td>
<td></td>
<td></td>
</tr>
<tr>
<td><asp:Label ID="LblItemInfo" runat="server" Text="iteminfo"></asp:Label></td>
<td> </td>
<td> </td>
</tr>
</table>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</asp:View>
<asp:View runat="server" ID="VOrderComplete">
<table class="auto-style1">
<tr>
<td> </td>
<td><asp:Label ID="LblOrderComplete" runat="server" Text="ordercomplete"></asp:Label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><asp:Label ID="LblOrderNumberAgain" runat="server" Text="ordernumberagain"></asp:Label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><asp:Label ID="LblOrderTimeAgain" runat="server" Text="ordertimeagain"></asp:Label></td>
<td> </td>
</tr>
</table>
</asp:View>
<br />
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>

Showing comments without reloading page

The code below get me a comment , puts it in the database and then waits for a page reload to show the comment. How can i make the submited comment to be shown right after it has been posted along with the new ones ? This is the code that does the stuff :
Layout:
<table>
<tr>
<td colspan="2">All Comments</td>
<td>
&nbsp
</td>
</tr>
<tr> <td colspan="2"> </td></tr>
<tr>
<td>
<asp:Repeater ID="Repeater1" runat="server" ItemType="SiteStiri.Models.Comments" SelectMethod="GetComments" >
<ItemTemplate>
<table>
<tr>
<td colspan="2">
<asp:Label id="lblDate" runat="server" Text='<%# Item.ReleaseDate %>'></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="lblComment" runat="server" Text='<%# Item.Comment %>'>
</asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
<AlternatingItemTemplate>
<table>
<tr>
<td colspan="2">
<asp:Label id="Label1" runat="server" Text='<%# Item.ReleaseDate %>'></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="Label2" runat="server" Text='<%# Item.Comment %>'>
</asp:Label>
</td>
</tr>
</table>
</AlternatingItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</td>
</tr>
<td>
<table>
<tr>
<td colspan="2" >Add Your Comment</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblStatus" runat="server" Visible="False"></asp:Label>
</td>
<td>
&nbsp
</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtcomment" runat="server" TextMode="MultiLine">
</asp:TextBox>
</td>
<td>
&nbsp
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</td>
<td>
&nbsp
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>
Code Behind:
public void fnSubmitComment()
{
AddComment cmt = new AddComment();
String x = Request.QueryString["newsID"].ToString();
int y = Convert.ToInt32(x);
bool addSucces = cmt.Addcomment( y , txtcomment.Text);
if (addSucces)
{
lblStatus.Text = "Your Comment has been Added Successfully.";
}
else
{
lblStatus.Text = "Your Comment has not been Added.";
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
fnSubmitComment();
}
public IQueryable<Comments> GetComments()
{
var _db = new SiteStiri.Models.CommentsContext();
IQueryable<Comments> query = _db.Comments;
String x = Request.QueryString["newsID"].ToString();
int y = Convert.ToInt32(x);
query = query.Where(p => p.NewsID == y);
return query;
}
I heard i can do that with ajax ? (My knowledge about ajax is 0 currently) Any tips on how i can do this ?
You must wrapper you repeater in an updatepanel,
set UpdateMode="Conditional" and add a trigger on btnSubmit so when click the button the update the repeater with the normal page life cycle
Remember to bind the repeater after that you add the commet in the codebehind and must be present in your page a ScriptManager control
more or less thus
<asp:ScriptManager runat="server" />
<table>
<tr>
<td colspan="2">All Comments</td>
<td>&nbsp
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td>
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="Repeater1" runat="server" ItemType="SiteStiri.Models.Comments" SelectMethod="GetComments">
<ItemTemplate>
<table>
<tr>
<td colspan="2">
<asp:Label ID="lblDate" runat="server" Text='<%# Item.ReleaseDate %>'></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="lblComment" runat="server" Text='<%# Item.Comment %>'>
</asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
<AlternatingItemTemplate>
<table>
<tr>
<td colspan="2">
<asp:Label ID="Label1" runat="server" Text='<%# Item.ReleaseDate %>'></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="Label2" runat="server" Text='<%# Item.Comment %>'>
</asp:Label>
</td>
</tr>
</table>
</AlternatingItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td colspan="2">Add Your Comment</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblStatus" runat="server" Visible="False"></asp:Label>
</td>
<td>&nbsp
</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtcomment" runat="server" TextMode="MultiLine">
</asp:TextBox>
</td>
<td>&nbsp
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</td>
<td>&nbsp
</td>
</tr>
</table>
</td>
</tr>
</table>

How to initialize onclick method before ModalPopupExtender take place?

because I manually want to show the modal popup (this might be due to the fact that the controls inside the popup have to initialized according to the pressed button or row). Can anyone help me? The button NEVER goes to this EditBtn_Click method, it just aways show my panel.
Code:
protected void EditBtn_Click(object sender, EventArgs e)
{
LinkButton btn = (LinkButton)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
int i = Convert.ToInt32(row.RowIndex);
string uid = (string)ManageStaffGrid.Rows[i].Cells[1].Text;
//bind panel
AjaxControlToolkit.ModalPopupExtender mpe = (AjaxControlToolkit.ModalPopupExtender)row.FindControl("EditBtn_ModalPopupExtender");
mpe.Show(); //show the modal popup extender
}
Design:
(from grid)
<ItemTemplate>
<asp:LinkButton ID="EditBtn" runat="server" onclick="EditBtn_Click">Edit</asp:LinkButton>
<asp:ModalPopupExtender ID="EditBtn_ModalPopupExtender" runat="server" CancelControlID="CancelBtn" Enabled="True" PopupControlID="UpdatePanel" TargetControlID="EditBtn">
</asp:ModalPopupExtender>
</ItemTemplate>
<asp:Panel ID="UpdatePanel" runat="server" Style="display: none" BackColor="White" GroupingText="Update User">
<div>
<table><tr>
<td style="width:12px"></td>
<td><asp:Label ID="lblLegend" runat="server" Text=""></asp:Label></td></tr></table>
<br />
<table>
<tr>
<td style="width:12px"></td>
<td style="width: 76px">
<asp:Label ID="lblName" runat="server" Text="Name"></asp:Label>
</td>
<td>
<asp:Label ID="lblStaffName" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td style="width:12px"> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
<asp:Label ID="lblUserId" runat="server" Text="User ID"></asp:Label>
</td>
<td>
<asp:Label ID="lblStaffUid" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td valign="top" style="width: 70px">
<asp:Label ID="lblSection" runat="server" Text="Section"></asp:Label>
</td>
<td>
<asp:ListBox ID="listSection" runat="server" SelectionMode="Multiple"
CssClass="standardManage" onMouseDown="GetCurrentListValues(this);"
onchange="FillListValues(this);">
</asp:ListBox>
</td>
<td valign="top">
<asp:RequiredFieldValidator ID="RequiredValidatorSection" runat="server"
ControlToValidate="listSection" Display="Dynamic" EnableClientScript="False"
EnableTheming="True" ErrorMessage="Required" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:Label ID="lblValidatorSection" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
<asp:Label ID="lblFunction" runat="server" Text="Function"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlFunction" runat="server" CssClass="standardManage">
</asp:DropDownList>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
<asp:Label ID="lblStaffGender" runat="server" Text="Gender"></asp:Label>
</td>
<td>
<asp:Label ID="lblGender" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
<asp:Label ID="lblRole" runat="server" Text="Role"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlRole" runat="server" CssClass="standardManage">
</asp:DropDownList>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 76px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td style="width: 70px">
</td>
<td align="right">
<asp:Button ID="UpdateBtn" runat="server" Text="Update" OnClick="UpdateBtn_Click"/>
<asp:Button ID="CancelBtn" runat="server" Text="Cancel" />
</td>
<td>
</td>
</tr>
</table>
</div></asp:Panel>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
i found a very helpful link that eventually solves my problems! Please check it out!
http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html

Categories