|
i am new to asp.net
in exception handlig can we create more than one try block
can we catch different error in one try catch blocks
plz help me
prasad.g
|
|
|
|
|
|
I need to convert the following code into .net. the existing code is in coldfusion and runs as a background process.
Can someone help me in converting this coldfusion code to .net code.
<code>
<CFPARAM NAME="ATTRIBUTES.JUSTIFY" DEFAULT="no">
<CFIF NOT ThisTag.HasEndTag>
<CFABORT SHOWERROR="You need to supply a closing <CF_FileWriteText> tag.">
</CFIF>
<CFIF ThisTag.ExecutionMode is "End">
<!--- If it has <pre> or <code> tags, just leave the whole page alone!! --->
<!--- When CF reg expressions have non-greedy searching, I'll deal with this more intelligently --->
<CFIF REFindNoCase("<pre>|<code>", ThisTag.GeneratedContent) EQ 0>
<!--- Replace whitespace between CR/LFs with a single CF/LF --->
<!--- That fixes almost all of the major whitespace --->
<CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "[#Chr(13)##Chr(10)#]+[[:space:]]*[#Chr(13)##Chr(10)#]+", "#Chr(13)##Chr(10)#", "ALL")>
<!--- If JUSTIFYing, remove whitespace at beginning of each line --->
<CFSET ATTRIBUTES.JUSTIFY = ucase(ATTRIBUTES.JUSTIFY)>
<CFIF ATTRIBUTES.JUSTIFY EQ "Y" OR ATTRIBUTES.JUSTIFY EQ "YES">
<CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "[#Chr(13)##Chr(10)#][[:space:]]*", "#Chr(13)##Chr(10)#", "ALL")>
</CFIF>
</CFIF>
</CFIF>
<CFSETTING ENABLECFOUTPUTONLY="NO">
</code>
Thank you in advance.
Sudip
-- modified at 3:40 Thursday 7th September, 2006
|
|
|
|
|
+ "Help" is a useless title, see Chris's golden rules[^].
+ Cannot give you a direct anwser as I have no idea about ColdFusion, sorry, but the migration site[^] may give some ideas.
|
|
|
|
|
|
|
HI Satips,
I got the Framwork . Need the documentation.
|
|
|
|
|
Do you find anything ?
AUS Enrique Ferreyra
(Pachu)
|
|
|
|
|
There is one in java :
http://www.jpos.org/
|
|
|
|
|
I am pretty new to ASP.net and I am trying to write a login page that uses forms authentication.
I keep getting an error in my formsAuthentication when trying to set my cookie and redirect to the previous page. Please see my code:
formsauthentication.redirectfromloginpage(pstrUserId, False)
Errors says: formsauthentication not declared!
Here is my webconfig:
<authentication mode="Forms">
<forms name="AuthCookie" loginurl="login.aspx">
Help
|
|
|
|
|
Use like this in ur web.config,
<authentication mode="Forms">
<forms name="AuthCookie" loginurl="Login.aspx" defaulturl="Default.aspx" timeout="60" protection="All" cookieless="AutoDetect">
</authentication>
You'll also need to modify the authorization section of the Web.config file:
<authorization>
<deny users="?" />
</authorization>
ASP.NET 2.0
-- modified at 0:53 Thursday 7th September, 2006
Regards,
Jay
|
|
|
|
|
Hi ...
I am preparing ASP.net page and on page load I am storing all user name in Data view. Now when user clicks on asp button to check whether this user is available or not I am calling java script to open a popup window with dynamic message. This window needs to be open with query string icount which is my view.count value.
How I can pass my server control value to java script?
Code is as below
Class
Public icount as integer
On Page Load…
GetUserName() /* this will bring all username and store in session*/
Me.CmdCheckAvl.Attributes.Add("onClick", "return bValidateUserName(icount);")
On Click of button…
Dim UserNameVw As New DataView=Session("UserName")
UserNameVw.RowFilter = "UserName=" & Me.TxtUserName.Text
icount = UserNameVw.Count
JavaScript in include file is as below
function bValidateUserName(icount)
{
if(ISNull("TxtUserName") == true)
{
alert("Please provide User Name first");
return false;
}
else
{
window.open("UserExists.aspx"?UserAvl=icount,null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
}
return true;
}
Amit
|
|
|
|
|
Just a small Note...
As soon as i hard code my value in page load Attribute.Add it works fine....
On Page Load…
GetUserName() /* this will bring all username and store in session*/
Me.CmdCheckAvl.Attributes.Add("onClick", "return bValidateUserName(1);")
Humm....I am confused? Please help me...or let me know some workaround to solve this probelm....
Thanks for your time and effort...
Cheers
Amit
|
|
|
|
|
You can populate icount variable and do something like:
Me.CmdCheckAvl.Attributes.Add("onClick", "return bValidateUserName(" & icount & ");")
|
|
|
|
|
i will try and will update you. Thanks for your reply.
Amit
|
|
|
|
|
Hi
Thanks for your reply. and i am able to open new window. But it does not solve my problem...
1) On click of button, I want to invoke java script with a parameter.
2) Java script will open new window with parameter value.
3) And parameter value will be calculated at server on click of same go button.
So my seq would be 1 -3 and 2 step.
and currently it is doing 1-2-3 so everytime parameter value is zero
Please help me.
Amit
|
|
|
|
|
Hi,
in our ASP.Net Application how can we find/restrict a user so that he does not work on the same application from different browser windows.
thanks and regards,
Deepak Surana
|
|
|
|
|
The link[^] can give you some ideas.
|
|
|
|
|
Hi,
I'm populating a datagrid in ASP.NET 1.1 and after binding it to a collection, the ItemDataBound event allows me to access the data after it's entered as a row into the grid. I can add tooltips to the individual cells depending on the cell value and so on, which is very useful. However, I also have need to exclude some of my items from ever being displayed in the grid and so I'd like to handle an event which occurs before each row in the datagrid is populated. In this way I can filter the contents of my datagrid rather than apply any filtering to the collection class which for one reason or another, I don't wish to do.
Is there any way of capturing the item *before* it's added to the grid to stop it ever being displayed? In other words, can I filter a grid at this level?
Evil cannot be conquered in the world... It can only be resisted within oneself.
|
|
|
|
|
Hi there,
In this case, you can think of hiding the datagrid row (DataGridItem) using the Visible property, so depending on the databound bound to the row you can set either the specific cells of the row or the entire row invisible, and the user does not see that displayed on the grid.
|
|
|
|
|
Sir,
I want to confirm before deleting the row in the datagrid.By givig the message Are u sure u want to delete the record.
For that I am using the following code.
Select Case e.Item.ItemType
Case ListItemType.AlternatingItem, ListItemType.EditItem, ListItemType.Item
Dim b As Button
b = e.Item.FindControl("b")
b.Attributes.Add("onclick", "return confirm('Are you sure you want to delete ?');")
End Select
Now the problem My code for deleting the record is written in ItemCommand function of datagrid but control is not going after i press the ok botton of the messagebox.
Please help.
Thank You.
|
|
|
|
|
In ItemDataBound event add code below:
If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then <br />
Dim obj As Object = e.Item.Cells(4).Controls(0) <br />
Dim item As String = "this item" <br />
<br />
obj.Attributes("onclick") = String.Format("javascript:return confirm('Are you sure you want to delete {0}?')", item) <br />
<br />
End If
For more detail visit:
http://www.programmingknowledge.com/simpleDataGrid.aspx[^]
|
|
|
|
|
I have a Repeater which is bound to an ObjectDataSource. Its item template contains a Gridview and ObjectDataSource, displaying details for each item in the repeater. The Repeater's ObjectDataSource has three parameters, a date range and name. I set the default value of name to '%'. Everything displays fine, but when you try to edit a row in on of the grids, the page posts back, but the row is not in edit mode... I tried setting the parameters programmatically, which got my edit working, but when the name field was empty and I passed '%' in, I get unexpected results (different than what my table adapter returns with the same parameters when I preview the data through the designer). Anyone have some insight on this?
-- modified at 12:16 Wednesday 6th September, 2006
Just noticed something, if I use control parameters and enter the value '%' in the name text box, then the edit works correctly... But '%' is the default value for that parameter, so how is that any different?
-- modified at 14:19 Wednesday 6th September, 2006
I just discovered the reason the edit workes when the name textbox has a value. It causes the execution of the select method on my repeater's ObjectdataSource. Any ideas why that would affect the editing?
|
|
|
|
|
I guess that your sample code to build the gridview control relies on something such as the data binding expression ... that requires the Repeater's ObjectDataSource to execute its Select command. Below is a working sample with the two tables Categories and Products of the Northwind:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource1">
<ItemTemplate>
<%# Eval("CategoryName") %>
<br />
<asp:Label runat="server" ID="lblCategoryID" Visible="false" Text='<%# Eval("CategoryID") %>'></asp:Label>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource2">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" />
<asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetProducts"
TypeName="Samples.AspNet.ObjectDataSource.NorthwindData">
<SelectParameters>
<asp:ControlParameter ControlID="lblCategoryID" Name="categoryID" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnSelecting="ObjectDataSource1_Selecting"
SelectMethod="GetCategories" TypeName="Samples.AspNet.ObjectDataSource.NorthwindData">
<SelectParameters>
<asp:Parameter DefaultValue="%" Name="name" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource2">
<Columns>
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetCategories"
TypeName="Samples.AspNet.ObjectDataSource.NorthwindData">
<SelectParameters>
<asp:Parameter DefaultValue="%" Name="name" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
You might want to post your code snippets if you still cannot figure it out.
|
|
|
|
|
Thanks for the reply, though I don't see what is different about the what I am doing and my edit does not work...
<asp:repeater id="repCommunities" runat="server" datasourceid="odsCommunity" enableviewstate="false">
<ItemTemplate>
<asp:HiddenField ID="txtID" runat="server" Value='<%# Eval("community_id") %>' />
<asp:GridView ID="gvCommunity" runat="server" AutoGenerateColumns="False" DataKeyNames="delay_id" DataSourceID="odsDelay">
<Columns>
<asp:BoundField DataField="delay_id" HeaderText="delay_id" InsertVisible="False" ReadOnly="True" SortExpression="delay_id" />
<asp:BoundField DataField="delay_day" HeaderText="delay_day" SortExpression="delay_day" />
<asp:BoundField DataField="delay_creator" HeaderText="delay_creator" SortExpression="delay_creator" />
<asp:BoundField DataField="delay_date" HeaderText="delay_date" SortExpression="delay_date" />
<asp:BoundField DataField="community_id" HeaderText="community_id" SortExpression="community_id" />
<asp:BoundField DataField="delay_action" HeaderText="delay_action" SortExpression="delay_action" />
<asp:BoundField DataField="delay_lot" HeaderText="delay_lot" SortExpression="delay_lot" />
<asp:BoundField DataField="delay_reason" HeaderText="delay_reason" SortExpression="delay_reason" />
<asp:CommandField ShowEditButton="true" />
</Columns>
</asp:GridView>
<br />
<asp:ObjectDataSource ID="odsDelay" runat="server" OldValuesParameterFormatString="original_{0}" TypeName="daSQL" SelectMethod="GetDelaysByCommunityAndDateRange" UpdateMethod="UpdateDelayAction" DeleteMethod="DeleteCommunity" InsertMethod="InsertDelay">
<SelectParameters>
<asp:ControlParameter ControlID="txtID" PropertyName="Value" DefaultValue="1" Name="communityID" />
<asp:ControlParameter ControlID="txtFrom" PropertyName="Text" DefaultValue="" Name="from" />
<asp:ControlParameter ControlID="txtTo" PropertyName="Text" DefaultValue="" Name="to" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="delay_lot" Type="String" />
<asp:Parameter Name="delay_day" Type="Int32" />
<asp:Parameter Name="delay_reason" Type="String" />
<asp:Parameter Name="delay_action" Type="String" />
<asp:Parameter Name="original_delay_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="lot" Type="String" />
<asp:Parameter Name="day" Type="Int32" />
<asp:Parameter Name="creator" Type="String" />
<asp:Parameter Name="reason" Type="String" />
<asp:Parameter Name="communityID" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>
</ItemTemplate>
</asp:repeater>
<asp:objectdatasource id="odsCommunity" runat="server" oldvaluesparameterformatstring="original_{0}"
selectmethod="GetUpdatedCommunitiesByDateRange" typename="QuadrantTableAdapters.communityTableAdapter"
deletemethod="Delete" insertmethod="Insert" updatemethod="Update" enableviewstate="False">
<DeleteParameters>
<asp:Parameter Name="Original_community_id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="community_name" Type="String" />
<asp:Parameter Name="community_active" Type="Boolean" />
<asp:Parameter Name="Original_community_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="community_name" Type="String" />
<asp:Parameter Name="community_active" Type="Boolean" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="txtFrom" Name="from" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtTo" Name="to" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtCommunity" Name="name" PropertyName="Text" Type="String" DefaultValue="%" />
</SelectParameters>
</asp:objectdatasource>
|
|
|
|