|
Good Day all
i have the following
<%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%>
and the Function CleanBondNumber is defined like this
Public Shared Function CleanBondNumber(ByVal val As Object) As String
Dim Final_bond_acc_no As String = String.Empty
If (val.ToString().Contains("Offer")) Then
Dim Finalstring As String
Finalstring = val.ToString.Substring(6)
If (Finalstring.Contains(" ")) Then
Dim SpacePost As Integer
SpacePost = Finalstring.IndexOf(" ")
Final_bond_acc_no = Finalstring.Substring(0, SpacePost - 1)
Return Final_bond_acc_no
Else
Return val.ToString()
End If
Else
If (val.Contains(" ")) Then
Dim SpacePost As Integer
SpacePost = val.IndexOf(" ")
Final_bond_acc_no = val.Substring(0, SpacePost - 1)
Return Final_bond_acc_no
Else
Return val.ToString()
End If
End If
End Function
i stepped through the code and after it returns something i cant bind the Data, i get an Exception
<%# clsFlow.CleanBondNumber(Eval("ATB_NUMBER"))%> '=' expected.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
CommandName='<%# GetCommandNamebunit(Container.DataItem) %>'
And in code behind
Function GetCommandNamebunit(ByVal dataItem As Object) As String
GetCommandNamebunit = "demotext"
GetCommandNamebunit = String.Empty
Dim texpinnerText = DirectCast(dataItem, Object).texp
Dim bunitinnerText = DirectCast(dataItem, Object).bunit
Dim rexpinnerText = DirectCast(dataItem, Object).rexp
Dim bunitid = DirectCast(dataItem, Object).id
Dim Str_blevel
Dim str_alig
Dim str_TFrame
Dim str_bunit
Dim str_fiscalY
Str_blevel = sltBusinessLevel.SelectedValue
str_alig = sltAlignmentLevel.SelectedValue
str_TFrame = sltTimeFrame.SelectedValue
str_bunit = sltBusinessUnit.SelectedValue
str_fiscalY = sltFiscalYear.SelectedValue
If str_alig = 1 Then
If Str_blevel < 4 Then
If texpinnerText <> "0" Then
GetCommandNamebunit = "sendModuleValues"
End If
Else
If texpinnerText <> "0" Then
GetCommandNamebunit = "setonefacility"
End If
End If
Else
If Str_blevel < 3 Then
If texpinnerText <> "0" Then
GetCommandNamebunit = "sendModuleValues"
End If
Else
If texpinnerText <> "0" Then
GetCommandNamebunit = "setonefacility"
End If
End If
End If
End Function
This is working fine for you can take help from this.
Anuj
modified 14-Nov-11 3:24am.
|
|
|
|
|
Hello all,
I work for a small IT firm and I have been assigned a task to work with few in-house developers in developing our internal Employee Portal which include, Time Tracker System, HR Portal, Performance Tracker and Asset management System, All deployed on one Windows Small Business Server.
The requirements gathering and documentation is almost done and we are about to start working on core development.
However, as I lack a project level knowledge while developing web applications. Can I get help on what best practices should I be implementing even from the database design stage?
The application is intended to be interacted by close to 200 people and half of them concurrently, at times. Most of the data tables are expected to be use by different modules of the same application.
Any help with guidelines to be followed while designing the database and application layers, will be greatly appreciated.
Any freelancing or consulting help is also invited. You can send me an email sunilsasadm@gmail.com
Thank you.
|
|
|
|
|
I think there are other forums within CodeProject that may be a better place to post your question to.
|
|
|
|
|
oh okie. Could you please suggest the appropriate section?
|
|
|
|
|
On the left hand side, there are:
- Design and Architecture
- Database
|
|
|
|
|
Hello,
There is a page into my asp.net application which must be requested only by myself (administrator) or by an externel tool like Windows task scheduler, pingdom, curl.exe, and so on.
Because this page contains some code to send e-mail to many users.
When the page is requested par the following url http://www.mysite.com/Send.aspx the code behind do the work.
This page is'nt accessible by my web site interface but it's located at the web site roots.
Is there anyway to protect this page to avoid someone (a non-authorize user) run it???
thank's for your help
|
|
|
|
|
|
When the user click on the button in the datapager (like previous, next, 1,2,3,4,....), it should direct him/her to that page. Without the update panel, it works fine. However, with the update panel, only the first page can be correctly shown. When the users click the button in the datapager, even the listview disappear and I don't know why. I have searched for a few sites but none of them give me a satisfactory result. Am I missing out something? Thank you.
http://www.sendspace.com/file/c8yimj <----the aspx file (Please find the part marked with scriptmanager and update panel)
http://www.sendspace.com/file/nel2xu <---- the c# file (Please begin from the method DataPager1_PreRender
|
|
|
|
|
|
The code are here...
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<asp:UpdatePanel ID="UpdatePanel1" Updatemode="Always" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<asp:ListView ID="ListView1" runat="server"
OnItemCommand="ListView1_OnItemCommand" GroupItemCount="1">
<LayoutTemplate>
<div style="border: solid 1px black">
<table>
<asp:PlaceHolder ID="groupPlaceHolder" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<div>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</div>
</GroupTemplate>
<ItemTemplate>
<tr>
<td>
<asp:LinkButton ID="LinkButton1" CommandName="Delete_item" CommandArgument='<%# Eval("entry_no") %>' runat="server" Text="Delete!" />
</td>
</tr>
<tr>
<td>Location: <%#Eval ("location") %></td>
</tr>
<tr>
<td>Type:<%#Eval ("type") %><asp:ImageButton ID="ImageButton1" onClientClick = "Button1_onclick()" runat="server" ImageUrl="play.gif" CommandName="Listen" CommandArgument='<%#Eval("type") %>'/></td>
</tr>
<tr>
<td>Further Description: <%#Eval ("further_description") %><asp:ImageButton ID="Play_btn" runat="server" ImageUrl="play.gif" CommandName="Listen" CommandArgument='<%#Eval("further_description") %>' OnClientClick="popup('popUpDiv')" /></td>
</tr>
<tr>
<td><%# test_item_photo_name(Eval("items_photo_name").ToString()) %></td>
</tr>
<tr>
<td><asp:Button runat="server" Text="Play Recordings" CommandName="Recordings" CommandArgument='<%#Eval("recordings") %>' ID="recordings_btn" Visible="True" />
</tr>
</ItemTemplate>
</asp:ListView>
<asp:DataPager ID="pg" PageSize="1" runat="server" OnPreRender="DataPager1_PreRender" PagedControlID="ListView1">
<Fields>
<asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</div>
Code behind:
protected void DataPager1_PreRender(object sender, EventArgs e)
{
DataTable result = (DataTable)Session["result"];
ListView1.DataSource = result;
ListView1.DataBind();
}
protected void pg_PagerCommand(object sender, DataPagerCommandEventArgs e)
{
e.NewMaximumRows = e.Item.Pager.MaximumRows;
switch (e.CommandName)
{
case "Previous":
if (e.Item.Pager.StartRowIndex > 0)
e.NewStartRowIndex = e.Item.Pager.StartRowIndex - 1;
break;
case "Next":
e.NewStartRowIndex = e.Item.Pager.StartRowIndex + 1;
break;
}
}
protected void ListView1_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
DataPager dpBottom;
dpBottom = ((ListView)sender).FindControl("pg") as DataPager;
dpBottom.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
ListView1.DataBind();
UpdatePanel1.Update();
}
protected void ListView1_OnItemCommand(object sender, ListViewCommandEventArgs e)
{
Label1.Visible = false;
if (String.Compare(e.CommandName.ToString(), "Recordings") == 0)
{
if (String.Compare(e.CommandArgument.ToString(), "") == 0)
{
Label1.Visible = true;
Label1.Text = "No recordings found.";
}
else
{
String path = Server.MapPath(".") + "\\" + login_hash + "\\others\\" + e.CommandArgument.ToString();
Play(path);
}
}
else
{
if (String.Compare(e.CommandName.ToString(), "Listen") == 0)
{
Speak(e.CommandArgument.ToString());
}
if (String.Compare(e.CommandName.ToString(), "Delete_item") == 0)
{
DataTable result = (DataTable)Session["result"];
for (int i = 0; i < result.Rows.Count; i++)
{
if (result.Rows[i]["entry_no"].ToString() == e.CommandArgument.ToString())
{
if (result.Rows[i]["recordings"].ToString() != "")
{
File.Delete(Server.MapPath(".") + "\\" + login_hash + "\\others\\" + result.Rows[i]["recordings"].ToString());
}
if (result.Rows[i]["items_photo_name"].ToString() != "")
{
File.Delete(Server.MapPath(".") + "\\" + login_hash + "\\images\\item_photo" + result.Rows[i]["items_photo_name"].ToString());
}
DataList1_ItemCommand(sender, null);
}
}
try
{
String query = "delete from items_location where entry_no = " + e.CommandArgument.ToString();
Database.OpenConnection();
Database.BeginTransaction();
Database.Update_Insert(query);
Database.CommitTransaction();
Database.CloseConnection();
ListView1.DataSource = result;
ListView1.DataBind();
Session.Remove("result");
Session["result"] = result;
}
catch (Exception ex)
{
Database.RollBackTransaction();
Database.CloseConnection();
}
}
}
}
|
|
|
|
|
Hi,
I have a flash map in my site, which cannot be displayed inside iframes in other domains. So what I wnat to do, is to check the domain name when the page is loaded and hide the flash map if it's other than my domain.
I have heared that there is a commonly used code for hiding flash in Iphones, that can be useful for me, but I couldn't find it, so maybe sompne can copy the code for me.
Thanks, Ben
|
|
|
|
|
benams wrote: there is a commonly used code for hiding flash in Iphones
Its called not being supported. Flash won't even load on an iPhone, iPod or iPad.
No comment
|
|
|
|
|
two articles on browser detection:
http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting[^]
http://jibbering.com/faq/notes/detect-browser/[^]
my recommendation though is to use a javascript framework which will take on most of the work for you. once you have determined your browser you can simply hide the div by setting its css display property to none .
just a note though you might still run into problems with the flash trying to run? I am not a huge fan of flash so I have never tried this route before.
my recommendation would be to add the iframe to your document only after you have determined that the browser supports it.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Hello,
Into my asp.net application every day i download an xml file and store the values in my database. After did this, i display this xml file using an aspx page. After displaying, an e-mail is sent to 2000 users who are subscribe to this info.
My problem is that i want to dipslay first the page to confirm there is no problem, then send the e-mail but because i use Response.Redirect function my code for sending e-mail is never run. If i send first the e-mail, i must wait for the end (5 minutes) before displaying xml value into my page.
Therefore i would to display my page and execute at the same time the function to send e-mail or sending the e-mail in asynchronous mode.
The part of my code with this problem is the following :
iRes = mydb.DBRecordPublication(strFilename, sDate, snumero, sDoc)
If iRes >= 0 Then
Dim NomMagazine As String = strFilename
Response.Redirect("ShowNews.aspx?News=" & NomMagazine & "&DateNews=" & sDate & "&ConnecString=" & mydb.GetConnectionString())
Dim strRes As String = myMail.SendSommaire(Me.Context)
end if
thanks in advance for any help
|
|
|
|
|
Although you can implement an aysnc page you may be better using Ajax. Display the page with a button to send the emails. The button will call an Ajax function that will send the emails. A side benefit is you can get updates on the number of emails sent, if you code it that way.
No comment
|
|
|
|
|
In a C# 2010 web form application that I will be working on, I want to place a dropdown list control in a detailview control. I do not these that control as one of embedded controls you can use. I do see controls like a hyperlink.
Thus can you tell me or point me to a reference so that I see how to place a dropdown list control within a detailsview control?
|
|
|
|
|
lmgtfy[^]
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Can you show me how to use a range validator for the dropdownlist 2010 webform control I listed below? I want
to make certain a value between 01 and 03 are selected.
Note: I am using a required validator on the web form 2010 control listed below.
<pre>
<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem Selected="True">Select a number</asp:ListItem>
<asp:ListItem Value="01" />
<asp:ListItem Value="02" />
<asp:ListItem Value="03" />
</asp:DropDownList>
</pre>
|
|
|
|
|
Did you even read the link I provided in your last post? Did you notice the List of Validation Controls? Did you see the long list of How To links?
We are here to assist but you must also make some effort. Being a successful developer means knowing where and how to look for information. You have been given the where. It's up to you to provide the how.
No comment
|
|
|
|
|
but I was wondering if you could also just do my work for me.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
how to generate id to every click on save button.
and every are assending order
|
|
|
|
|
You need to clarify what it is you are trying to accomplish.
No comment
|
|
|
|
|
Hello. This may or may not be an asp.net question but basically, we have a website & we have a situation where we need to know instantly if any users are viewing the site.
I know I can implement some code to create a session when a user visits the site and then log into the database when that user's session has expired (i.e. he's off the site), but even that wouldn't be completely accurate since session objects wait for about 20 minutes of inactivity before expiring. What I need is be able to determine whether any users are on the site currently, not within the last 20 minutes.
My other thought was perhaps there's some tools on the server itself that can help me with this (we use Windows Server 2003), but I wasn't sure if this was a possibility.
Any ideas on the best way to track this?
Thanks.
|
|
|
|
|
you can track pages loading and unloading via javascript. that way whenever a page loads or unloads you can call some server side code via ajax.
<html>
<body onload="alert('The page was loaded')" onunload="alert('The onunload event was triggered')">
</body>
</html>
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|