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();
Related
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;
}
}
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>
 
</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>
 
</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtcomment" runat="server" TextMode="MultiLine">
</asp:TextBox>
</td>
<td>
 
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</td>
<td>
 
</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> 
</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> 
</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtcomment" runat="server" TextMode="MultiLine">
</asp:TextBox>
</td>
<td> 
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</td>
<td> 
</td>
</tr>
</table>
</td>
</tr>
</table>
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
I'm working on the following
var result =
from ap in db.Appraisals
join at in db.AppraisalTypes
on ap.AppraisalType_ID equals at.AppraisalType_ID
join w in db.Workers
on ap.Worker_ID equals w.Worker_ID
where ap.Worker_ID == WorkerID
&& ap.DateDue != null
&& ap.DateCompleted == null
select new
{
ap.Worker_ID,
ap.Appraisal_ID,
at.Description,
ap.DateDue,
ap.DateCompleted,
CompletedBy = from ap2 in db.Appraisals
join w2 in db.Workers
on ap2.CompletedBy equals w2.Worker_ID
select new
{
name = w2.Surname + ", " + w2.FirstName
}
};
As you can probably see I am using two worker objects, one being the worker that is having their annual/interim employment appraisal and the other object is their line manager.
This select is used to bind a summary list view control but on the CompletedBy column I am trying to assign will always have the most up to date entry as being null then historic data will be populated with the line managers name when an appraisal has been completed. I have done a quick search on this question and there are many posts w/answers but I'm not very experienced as a developer and looking for a simple answer. My other concern is that I am trying to assign a column with something that I know will always have a null value in the list.
Although the compiler recognises this as being syntactically correct, on the bind my label text property has the following...
System.Collections.Generic.List`1[<>f__AnonymousType9`1[System.String]]
I am just looking to any possible caveats I am building here and to fill in the huge gaps to my very limited knowledge of LINQ.
<asp:ListView ID="lvwProbations" runat="server"
OnSelectedIndexChanged="lvwProbations_SelectedIndexChanged"
OnPagePropertiesChanged="lvwProbations_PagePropertiesChanged"
OnPagePropertiesChanging="lvwProbations_PagePropertiesChanging"
DataKeyNames="Worker_ID,Appraisal_ID">
<ItemTemplate>
<tr class="tableItemStyle"
onmouseover="this.style.backgroundColor='Silver'"
onmouseout="this.style.backgroundColor='#EAFFFF'">
<td>
<asp:Label ID="lblWorkerID" runat="server"
Text='<%# Bind("Worker_ID") %>' Visible="false" />
</td>
<td>
<asp:Label ID="lblProbation" runat="server" Width="200"
Text='<%# Bind("Description") %>' />
</td>
<td align="center">
<asp:Label ID="lblDateDue" runat="server" Width="100"
Text='<%# Bind("DateDue", "{0:d}") %>' />
</td>
<td align="center">
<asp:Label ID="lblDateCompleted" runat="server" Width="100"
Text='<%# Bind("DateCompleted") %>' />
</td>
<td align="center">
<asp:Label ID="lblCompletedBy" runat="server" Width="100"
Text='<%# Bind("CompletedBy") %>' />
</td>
<td>
<asp:ImageButton ID="btnSelect" runat="server"
SkinID="selecttimesheet" CommandName="Select" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr class="tableAlternatingItemStyle"
onmouseover="this.style.backgroundColor='Silver'"
onmouseout="this.style.backgroundColor='#CCFFFF'">
<td>
<asp:Label ID="lblWorkerID" runat="server"
Text='<%# Bind("Worker_ID") %>' Visible="false" />
</td>
<td>
<asp:Label ID="lblProbation" runat="server" Width="200"
Text='<%# Bind("Description") %>' />
</td>
<td align="center">
<asp:Label ID="lblDateDue" runat="server" Width="100"
Text='<%# Bind("DateDue", "{0:d}") %>' />
</td>
<td align="center">
<asp:Label ID="lblDateCompleted" runat="server" Width="100"
Text='<%# Bind("DateCompleted") %>' />
</td>
<td align="center">
<asp:Label ID="lblCompletedBy" runat="server" Width="100"
Text='<%# Bind("CompletedBy") %>' />
</td>
<td>
<asp:ImageButton ID="btnSelect" runat="server"
SkinID="selecttimesheet" CommandName="select" />
</td>
</tr>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table id="Table1" runat="server" style="">
<tr id="Tr2" runat="server" class="tableHoursHeaderStyle">
<th id="Th1" runat="server" style="width:0px;"></th>
<th id="Th2" runat="server">Appraisal</th>
<th id="Th3" runat="server">Date Due</th>
<th id="Th13" runat="server">Date Completed</th>
<th id="Th4" runat="server">Completed By</th>
<th id="Th6" runat="server" style="width:0px;"></th>
</tr>
<tr>
<td colspan="4">
<p>No Probations available</p>
</td>
</tr>
</table>
</EmptyDataTemplate>
<LayoutTemplate>
<table id="Table2" runat="server">
<tr id="Tr1" runat="server">
<td id="Td1" runat="server">
<table ID="itemPlaceholderContainer" runat="server"
border="0" class="TimeSheet_Table" style="">
<tr id="Tr2" runat="server"
class="tableHoursHeaderStyle">
<th id="Th1" runat="server" style="width:0px;"></th>
<th id="Th2" runat="server">Appraisal</th>
<th id="Th3" runat="server">Date Due</th>
<th id="Th13" runat="server">Date Completed</th>
<th id="Th5" runat="server">Completed By</th>
<th id="Th7" runat="server" style="width:0px;"></th>
</tr>
<tr ID="itemPlaceholder" runat="server"></tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
Edited to show markup/bindings on request
Your CompletedBy field is actually typed as a collection of a class that has a single string field. Because you are using a select new { name = ... } you are actually creating a class that looks like this which is not what you want at all:
class Anonymous9
{
public name { get; set; }
}
And, in addition, you are creating a IEnumerable<Anonymous9> which is collection of those objects.
Instead, you just want a single string. To get it to be just a single string, get rid of the new {} and wrap it with FirstOrDefault():
CompletedBy = (from ap2 in db.Appraisals
join w2 in db.Workers
on ap2.CompletedBy equals w2.Worker_ID
select w2.Surname + ", " + w2.FirstName
).FirstOrDefault()
Basically the question is:
how do i get the ImageID from a repeater so that i can pass it with a query string on button click?
For example: i need to edit a Image Details , each image have a edit button
As shown below:( generated by repeater)
c# code:
var List = new List<Images>();
foreach (DataRow dr in picture.Rows)
{
DateTime DateTemp = DateTime.Parse(dr["date"].ToString());
var childPhoto = new Images()
{
DateTaken = DateTemp.ToString("MM/dd/yyyy"),
PlaceTaken = dr["place"].ToString(),
DetailedInfo = dr["info"].ToString(),
ImageID = dr["ImageId"].ToString()
};
childList.Add(childPhoto);
}
ShowPhotoRepeater.DataSource = List;
ShowPhotoRepeater.DataBind();
}
}
}
protected void btnEditChildPhoto_Click(object sender, EventArgs e)
{
Response.Redirect("EditPhoto.aspx?ImageID=" + ));
}
My aspx code:
<asp:Repeater ID="ShowProfileRepeater" runat="server">
<ItemTemplate>
<table>
<tr>
<td width = "15%" rowspan="6"><%--<asp:Image ID="ImgPhoto" runat=server />--%>
<%--<asp:Image ID="childImage" ImageUrl="<%#Eval("ImgUrl")%>" runat="server" />--%>
<asp:Image ID="childImage" ImageUrl="~/img/missing children pictures/shearwey.jpg" CssClass="content_image" runat="server" />
</td><br />
<td width = "15%">Name:</td>
<td width = "70%">
<asp:Label ID="lblChildName" runat="server" Text='<%#Eval("Name")%>'></asp:Label></td>
<td >
<asp:Button ID="btnEditChildProfile" runat="server" Text="Edit" />
</td>
</tr>
<tr>
<td width = "15%">Gender:</td>
<td width = "55%">
<asp:Label ID="lblChildGender" runat="server" Text='<%#Eval("Gender")%>'></asp:Label></td>
<td></td>
</tr>
<tr>
<td width = "10%">Date Of Birth:</td>
<td width = "55%">
<asp:Label ID="lblChildDOB" runat="server" Text='<%#Eval("DOB")%>'></asp:Label></td>
<td></td>
</tr>
<tr>
<td width = "10%">Country:</td>
<td width = "55%">
<asp:Label ID="lblChildCountry" runat="server" Text='<%#Eval("Country")%>'></asp:Label></td>
<td></td>
</tr>
<tr>
<td width = "10%">Missing Date:</td>
<td width = "55%">
<asp:Label ID="lblChildMissingDt" runat="server" Text='<%#Eval("MissingDt")%>'></asp:Label></td>
<td></td>
</tr>
<tr>
<td width = "10%">Last Seen Location:</td>
<td width = "55%">
<asp:Label ID="lblChildLaseSeenLoc" runat="server" Text='<%#Eval("LastSeenLoc")%>'></asp:Label></td>
<td></td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
<asp:Button ID="btnEditChildProfile" runat="server" Text="Edit" CommandArgument='<%# Eval("ImageId")%>' />
protected void btnEditChildPhoto_Click(object sender, EventArgs e)
{
var btn = (Button)sender;
Response.Redirect("EditPhoto.aspx?ImageID=" + btn.CommandArgument));
}
Or
<a href='EditPhoto.aspx?ImageID=<%# Eval("ImageId") %>' >Edit</a>
Instead of using a button use a link button inside the repeater to redirect to the link you want. That way, you won't need a separate event handler for the button.
<asp:LinkButton PostBackUrl="EditPhoto.aspx?ImageID=<%#Eval("ImageId")%>"></asp:LinkButton>