|
There should only be two cases where the status label doesn't have a message:
- The
txtEmpID control is empty; - The stored procedure returned a row which was neither for this year nor the previous year;
You'll need to debug the code to see which is happening. Perhaps add a different message in the final Else ' Not this year, nor the previous year block.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If I temporarily comment this out:
' Clear the controls:
'txteName.Text = String.Empty
'txttitle.Text = String.Empty
'txtemail.Text = String.Empty
'txtEmpID.Text = String.Empty
'lblStatus.Text = String.Empty
'Gridview1.DataSource = Nothing
'Gridview1.DataBind()
it works but doesn't work if they are not commented out if I am using the correct empID with previous year's date and doesn't show the message: Not this year, nor the previous year even though I added that message to the Else block.
|
|
|
|
|
I suspect you just need to comment out the line:
txtEmpID.Text = String.Empty since that control is used further down to populate the parameter for the query.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks as always for your help.
I really, really appreciated it.
It is working real well now.
|
|
|
|
|
Hi, I am new to the OData World - I am researching, I have been given a task to connect to OData Services they have, they are exposing their Data through OData - that's what I understood, based upon that I have to write an ASP.Net client application, they have given URLs to connect to their OData Services, now I want to understand couple of things before I start writing my client app.
1. What's the use of exposing Data as OData over other web/rest services, why do we need it? Are there any security advantages?
2. What are the best ways to connect to OData Service from client like Entity Framework is better or just use .Net C#?
3. What precautions should I take when I am connecting and using a OData Service?
4. Any other suggestions you can give me would be very very appreciated - thanks a lot. I am also researching about it, but if you know something already also would be helpful - thanks again.
|
|
|
|
|
I am trying to apply filters from one dropdown in a datagrid to another dropdown in the same datagrid and same row. The "edit" screen shot is the most important.
The dropdown under "Chamber" will be used to filter the values in the "District" dropdown. Basically, the "Districts" are tied to a "Chamber". I am having a lot of trouble because of the EditItemTemplate sections.
Thank you for the help in advance!
<asp:GridView CssClass="datatable" ShowFooter="false" ShowHeaderWhenEmpty="true" DataKeyNames="ProfileTermID" DataSourceID="ldsTerms" ID="gvTerms" OnDataBound = "OnDataBound" OnRowCommand="gvTerms_RowCommand" runat="server" AutoGenerateColumns="False">
<HeaderStyle BackColor="#999999" ForeColor="#ffffff" />
<RowStyle CssClass="divRow" />
<EditRowStyle BackColor="#b3d4e8" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
<FooterStyle BackColor="#b3d4e8" Height="50px" VerticalAlign="Middle" HorizontalAlign="Center" />
<EmptyDataTemplate>
Legislator Has No Terms
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="ProfileID" HeaderText="ProfileID" />
<asp:TemplateField HeaderText="Term Start Date" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<telerik:RadDatePicker ID="rdtTermStart" Skin="Metro" runat="server" SelectedDate='<%#Eval("TermStartDate")%>'>
</telerik:RadDatePicker>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("TermStartDate", "{0:d}")%>
</ItemTemplate>
<FooterTemplate>
<telerik:RadDatePicker ID="rdtTermStartF" Skin="Metro" runat="server">
</telerik:RadDatePicker>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TermEndDate" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<telerik:RadDatePicker ID="rdtTermEnd" Skin="Metro" runat="server" Width="200px" SelectedDate='<%# IIf(IsDBNull(Eval("TermEndDate")), vbNull, Eval("TermEndDate")) %>' />
</EditItemTemplate>
<ItemTemplate>
<%# IIf(IsDBNull(Eval("TermEndDate")), vbNull, Eval("TermEndDate", "{0:d}")) %>
</ItemTemplate>
<FooterTemplate>
<telerik:RadDatePicker ID="rdtTermEndF" Skin="Metro" runat="server">
</telerik:RadDatePicker>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Chamber" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddChamber" DataSourceID="ldsChambers" DataTextField="Name" DataValueField="ID" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddChamber_SelectedIndexChanged" SelectedValue='<%# Bind("ChamberID") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_chamber.Name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddChamberF" AutoPostBack="true" OnSelectedIndexChanged="ddChamberF_SelectedIndexChanged" DataSourceID="ldsChambers" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Party" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddParty" DataSourceID="ldsParties" DataTextField="Name" DataValueField="ID" runat="server" SelectedValue='<%# Bind("PartyID") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_party.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddPartyF" DataSourceID="ldsParties" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="District" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddDistrict" DataSourceID="ldsDistricts" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_district.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddDistrictF" DataTextField="Name" DataValueField="ID" runat="server" >
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="County" ItemStyle-CssClass="divCell">
<EditItemTemplate>
<asp:DropDownList ID="ddCounty" DataSourceID="ldsCounty" DataTextField="Name" DataValueField="ID" runat="server" SelectedValue='<%# Bind("CountyID") %>'>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mod_county.name")%>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddCountyF" DataSourceID="ldsCounty" DataTextField="Name" DataValueField="ID" runat="server">
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="divCell" ItemStyle-Height="34px">
<EditItemTemplate>
<asp:ImageButton ID="ImageButton6" runat="server" CausesValidation="False" CommandName="Update" Text="Update" ToolTip="Update" ImageUrl="/admin/images/success.png" />
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Insert" ToolTip="Insert" Text="Insert" ImageUrl="/admin/images/success.png" />
</FooterTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" ImageUrl="/admin/images/ico_edit_a.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False" ItemStyle-CssClass="divCell" ItemStyle-Height="34px">
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" ImageUrl="/admin/images/ico_delete_a.png" />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" ImageUrl="/admin/images/ico_subtract.png" />
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="ImageButton7" runat="server" CausesValidation="False" CommandName="Cancel_New" Text="Cancel" ImageUrl="/admin/images/ico_subtract.png" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div >
</div>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Profiles" EnableDelete="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
EnableInsert="True" EnableUpdate="True" TableName="mod_Profiles" Where="ID == @ID">
<WhereParameters>
<asp:ControlParameter ControlID="lvContent" DefaultValue="0" Name="ID" PropertyName="SelectedValue"
Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsTerms" runat="server" ContextTypeName="CMSmodules.ModulesDataContext" EntityTypeName="" TableName="mod_ProfileTerms" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsDistricts" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Districts" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsParties" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Parties" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsChambers" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Chambers" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsCounty" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Counties" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsSessions" runat="server" ContextTypeName="CMSmodules.modulesDataContext"
TableName="mod_Sessions" OrderBy="Name" Select="new (ID, Name)">
</asp:LinqDataSource>
|
|
|
|
|
I have a web application based in aspnet 4.5 that is running on a Windows 2016 Server with IIS 10. The app allows to client the downloading of several documents (img, pdf, zip files). All works correctly from several years but starting from 4 weeks to now ios based client (ipad and iphone running 13.3 ios) receive corrupted files. Looking at the logs I have seen that the client closes the connection abnormaly.
this is the code snippets i use to send files:
Response.Clear();
System.IO.FileInfo fInfo = new System.IO.FileInfo(allegatizipfilename);
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.AddHeader("Content-disposition", "attachment; filename=allegati.zip");
Response.ContentType = "application/octet-stream";
Response.TransmitFile(allegatizipfilename);
Response.Flush();
Response.End();
I have tried to disable http2, to allow longer connection time, to reduce the minimal connection speed all with no results.
What is strange to me is the fact that anything worked fine till some week ago and nothing was changed in the server configuration nor the software code.
Anyone has the same issue ?
|
|
|
|
|
If it's presented as a standard download it might well be a header or CORS issue.
If it's an async download, the error likely lies in the javascript running in the browser.
Determine the download method, check the crapple browser API, and play "spot the difference".
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Thanks for your reply,
I will investigate over the things you suggest
But the very strange thing is that the same server configuration worked up to 4 weeks ago and everything is working well in Android or windows
Also we tried several browser as an alternative to Safari, all getting the same results... Is there in your opinion a chance of a bug in ios?
|
|
|
|
|
A lot of configurations, such as what encryption standards are acceptable, can be configured at the OS level; it's possible that they locked it down further. The odds of that serious a bug in something as well traversed as the network stack are unlikely.
Can you get wireshark on a client and see what's happening? That would allow you to troubleshoot the TLS handshake, and the overall traffic flow in general.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
It was simpler: ios Doesn't accepts octet-streams mime type...
|
|
|
|
|
Ah, ignoring the standard. There's a shock.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Hi,
Breaking my head, over this error, for which the reason according to all google results I have been able to find, is usually a simple omission of SelectCommandType="StoredProcedure", or some simple typo.
If this is the case for me, I am just not seeing it.
<asp:ListView ID="ListViewOrderRow"
runat="server"
DataKeyNames="rowguid"
DataSourceID="SqlDataSource1"
OnDataBound="ListViewOrderRow_DataBound">
<asp:Label ID="afp_nrLabel" runat="server" Text='<%# Eval("afp_nr") %>'></asp:Label>
<asp:Label ID="auf_trnrLabel" runat="server" Text='and lots more stuff like this'></asp:Label>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStringFDS %>"
ProviderName="<%$ ConnectionStrings:ConnectionStringFDS.ProviderName %>"
SelectCommand="sp_Warehouse_RowsByOrderNumberAndWarehouse"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="@OrderNumber"
QueryStringField="afp_nr"
Type="String" />
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="@Warehouse"
QueryStringField="wh_nr"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
The address shows that the necessary parameter values are being passed to the page:
"http://address/folder/OrderPicking.aspx?afp_nr=1586474&wh_nr=02"
Any and all help much appreciated.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Try omitting the "@" from the name
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="OrderNumber"
QueryStringField="afp_nr"
Type="String" />
<asp:QueryStringParameter Direction="Input"
DefaultValue="x"
Name="Warehouse"
QueryStringField="wh_nr"
Type="String" />
|
|
|
|
|
Hi,
Thanks for your reply. I omitted the @ characters, but unfortunately still no sigare.
Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
|
Why this code shows two images instead of one
protected void Page_Load(object sender, EventArgs e)
{
string divs = "<div class=" + "\"vlightbox1\">";
string divend = "</div>";
string anch = divs + "<a class=" + "\"vlightbox1\" " + "href=" + "\"index_files/vlb_images1/img20200127wa0004.jpg\"" + " " + ">"
+ "<img src=" + "\"index_files/vlb_thumbnails1/img20200127wa0004.jpg\"/" + "></a>" + divend;
string fnl = anch;
var imgcontrol2 = new HtmlGenericControl(fnl);
this.Page.Form.FindControl("ContentPlaceHolder2").Controls.Add(imgcontrol2);
}
|
|
|
|
|
I tried finding the solution or lead on how to implement dynamically updating the site with progress bar but on failing I am posting here.
My problem is that, I am fetching data from 4 different sources by hitting them in realtime and every source return data in blocks of results i.e. first 10 then, then again after querying by telling I have pulled previous then it again provide more. I want to show sorted data as and when I am able to fetch (I am able to fetch successfully) i.e. if I am able to receive data from first two sites I need to show them with sort on Alphabet then if again received more from those sites or other one again I should sort till all the results are fetched.
|
|
|
|
|
What exactly are you asking us to do?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
To dynamically put the lowest rate data on top while my website is fetching the data from different sources and also to show the progresss bar.
|
|
|
|
|
That is a lot of different things and a lot of different code. I don’t think anyone is going to write that code for you, so where exactly are you stuck?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You may want to think of building a WebService which executes in the background and one of the methods on that WebService is to return the progress of fetching data.
Kind of a "BlueSky" answer, but building WebSites fetching lots of data which takes a long time can be quite a challenge.
|
|
|
|
|
When I run my code, when I want to check the user who is logged in (this is a web application), the method called is having an error saying The method or operation is not implemented.
I need help to fix it by implementing the method.
Here is where the error occurs
try
{
foreach (string caseNumber in userEnteredCaseNumberList)
{
EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
newCandidate.CaseNbr = caseNumber;
newCandidate.RequestorInfoID = Convert.ToInt32(requestorItem.Value);
newCandidate.EntryStaffUserName = Helpers.Authentication.GetADEmail();
await CandidateCaseController.PostCandidate(newCandidate);
}
}
catch (Exception ex)
{
string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message);
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + errorMsg + "');", true);
}
Method that is called by line 8 with EntryStaffUserName. The error on on this method on line 7
public static string GetADEmail()
{
string retVal = string.Empty;
using (var context = new PrincipalContext(ContextType, "COURTS"))
{
UserPrincipal user = new UserPrincipal(context);
user = UserPrincipal.FindByIdentity(context, IdentityType, Environment.UserName);
retVal = user.EmailAddress;
}
return retVal;
}
|
|
|
|
|
Check the UserPrincipal.FindByIdentity functions if it has the following code in it:
throw new NotImplementedException();
|
|
|
|
|
I want to use FCKeditorV2 (Figure 2) http://www.mediafire.com/view/pdmvi0aezyqpil5/website2010_10b.jpg/file
instead of FreeTextBox (Figure 1) http://www.mediafire.com/view/oahtm7k3883elow/website2010_10a.jpg/file
The code I have edited
In file ArticleAddEdit.aspx
line 5:
original
H311457671H
edit
H1922776762H
line 79:
original:
<FTB:FreeTextBox id="txtBody"
TabIndex="3"
toolbarlayout="FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink|InsertTable,EditTable,InsertImageFromGallery"
runat="Server"
Width="585px" Height="200px"
/>
edit:
<FCKeditorV2:FCKeditor id="txtBody" ToolbarSet="MyToolbar" Width="600" Height="300" BasePath="~/FCKeditor/" runat="server" />
But when I change the code the following error message: http://www.mediafire.com/view/zpze8g7k7o3wm4a/website2010_10c.jpg/file
Line 40: txtTitle.Text = obj.Title;
Line 41: txtExcerpt.Text = obj.Excerpt;
Line 42: txtBody.Text = obj.Body;
Line 43: if (obj.Priority == 1)
Line 44: chkPriority.Checked = true;
For the original code
In file In file ArticleAddEdit.aspx
H725001498H
<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">
<uc:Title runat="server" ResourceKey='' Text='cập nhật bài việt' />
<table width="595" border="0" align="center" cellpadding="0" cellspacing="0">
<tr style="padding-top:5pt;">
<td colspan="2" align="center">
<asp:Label runat="server" ID="lblMsg" Font-Bold="true" ForeColor="blue"></asp:Label>
</td>
</tr>
<tr>
<td width="75%" >
<asp:ValidationSummary runat="server" ID="valChangePasswordSummary" ShowMessageBox="true" ShowSummary="false" />
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><%=ResourceManager.GetString("ArticleCategory") %>:</td>
</tr>
<tr>
<td style="padding-top:3pt;">
<webapp4U:ddlArticleCategory ID="dlArticleCategory" runat="server" CssClass="Textbox" />
<asp:RangeValidator runat="server" ControlToValidate="dlArticleCategory" ID="rvl1"
Type="Integer" MinimumValue="2" MaximumValue="1000" Display="dynamic"
ErrorMessage="Category not null" />
</td>
</tr>
<tr>
<td style="padding-top:10pt;"><%=ResourceManager.GetString("Title") %>:</td>
</tr>
<tr>
<td style="padding-top:3pt;">
<asp:TextBox ID="txtTitle" TabIndex="1" Font-Bold="true" runat="server" Width="380" MaxLength="500"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtTitle" runat="server" ErrorMessage="Title not null" Display="None" />
</td>
</tr>
<tr>
<td style="padding-top:10pt;"><%=ResourceManager.GetString("Article_Trichdan") %>:</td>
</tr>
<tr style="padding-top:3pt;">
<td>
<asp:TextBox ID="txtExcerpt" TabIndex="2" TextMode="MultiLine" Rows="5" runat="server" Width="380" MaxLength="3000"></asp:TextBox>
</td>
</tr>
</table>
</td>
<td valign="top" width="90" style="padding-top:20pt;">
<table border="0" cellpadding="0" width="90" >
<tr>
<td style="padding-top:5pt;" height="90" width="100%" valign="top" align="center">
<img name="ImageItem" id="ImageItem" runat="server" border="1" src="~/WebMaster/Images/Picture.jpg" width="80"/>
<input type="hidden" runat="server" id="HiddenImageName" name="HiddenImageName" value="" />
<input type="hidden" runat="server" id="HiddenImageWidth" name="HiddenImageWidth" value="-1" />
<input type="hidden" runat="server" id="HiddenImageHeight" name="HiddenImageHeight" value="-1" />
</td>
</tr>
<tr>
<td>
<input type="button" class="btupload" value=" Upload Picture" onclick='window.open("UploadFile.aspx?ActUpload=article","khunghinh","width=420,height=200,menubar=no,scrollbars=yes")' />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr style="padding-top:8pt; padding-bottom:3pt;">
<td colspan="2" ><%=ResourceManager.GetString("Article_Body") %> :</td>
</tr>
<tr>
<td colspan="2" style="font-size:0.7em">
<FTB:FreeTextBox id="txtBody"
TabIndex="3"
toolbarlayout="FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink|InsertTable,EditTable,InsertImageFromGallery"
runat="Server"
Width="585px" Height="200px"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right" style="padding-top:7pt; padding-right:3pt; padding-bottom:20pt;">
<asp:CheckBox runat="server" ID="chkPriority" Text="" TextAlign=Left />
Tin nổi bật(Hiển thị trên cùng)
<asp:Button runat="server" TabIndex="4" ID="btSave" OnClick="btSave_Click" Text=" Save " CssClass="textbox" />
</td>
</tr>
</table>
<br /><br /><br /><br />
</asp:Content>
In file In file ArticleAddEdit.aspx.cs
namespace webapp4U.UI
{
public partial class ArticleAddEdit : System.Web.UI.Page
{
private int ArticleID = -1;
private int CateID = -1;
protected void Page_Load(object sender, EventArgs e)
{
ArticleID = Globals.GetIntFromQueryString("ArticleID");
CateID = Globals.GetIntFromQueryString("CateID");
if (Request.QueryString["Action"] == "Edit")
{
btSave.CommandArgument = "Edit";
btSave.Text = " Update ";
if (!IsPostBack)
{
Load_GetItemByArticleID(ArticleID);
}
}
}
protected void Load_GetItemByArticleID(int ArticleID)
{
webapp4U.BOL.Article obj = webapp4U.BOL.Article.GetArticleByArticleID(ArticleID);
txtTitle.Text = obj.Title;
txtExcerpt.Text = obj.Excerpt;
txtBody.Text = obj.Body;
if (obj.Priority == 1)
chkPriority.Checked = true;
if(obj.ImageURL.Length>3)
ImageItem.Src = Globals.ApplicationPath + "/UserUpload/Articles/" + obj.ImageURL;
if (obj.ImageWidth > obj.ImageHeight)
ImageItem.Width = 80;
else
ImageItem.Height = 80;
dlArticleCategory.SelectedValue = obj.ArticleCateID.ToString();
HiddenImageName.Value = obj.ImageURL;
HiddenImageWidth.Value = obj.ImageWidth.ToString();
HiddenImageHeight.Value = obj.ImageHeight.ToString();
}
protected void btSave_Click(object sender, EventArgs e)
{
webapp4U.BOL.Article obj = new webapp4U.BOL.Article();
obj.ArticleID = ArticleID;
obj.Title = txtTitle.Text.Trim();
obj.Excerpt = txtExcerpt.Text.Trim().Replace(Environment.NewLine, "<br>");
obj.Body = txtBody.Text;
obj.PostDate = DateTime.Now;
obj.Priority = 0;
if (chkPriority.Checked)
obj.Priority = 1;
obj.ImageURL = HiddenImageName.Value.Trim();
obj.ImageWidth = Convert.ToInt32(HiddenImageWidth.Value.Trim());
obj.ImageHeight = Convert.ToInt32(HiddenImageHeight.Value.Trim());
obj.Authors = " ";
obj.ArticleCateID = Globals.ConvertToInt32(dlArticleCategory.SelectedItem.Value);
if (btSave.CommandArgument == "Edit")
{
obj.TotalViews = 0;
webapp4U.BOL.Article.Update(obj);
}
else
{
webapp4U.BOL.Article.Insert(obj);
}
Response.Redirect("Default.aspx?CateID=" + CateID);
lblMsg.Text = "Cập nhật thông tin thành công!";
}
}
}
or see the attached file: http://www.mediafire.com/file/pzydjnj8zp7jd41/website2010_10.rar/file
Reference links
https://expressmagazine.net/development/1558/huong-dan-dua-fck-editor-vao-web-aspnet
https://docs-old.ckeditor.com/FCKeditor_2.x/Developers_Guide/Integration/ASP.NET
modified 15-Jan-20 2:54am.
|
|
|
|
|