|
When I create a new MVC view page this what the top of the page lookslike:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
There is no code behind attribute. What am I doing wrong?
|
|
|
|
|
on ASP.NET MVC the Code Behind class was replaced by Controller class, each view has a Controller
|
|
|
|
|
I want to replace a specified subString is a string by javascript.
I don't know the exact substring part, just I know it starts with <layer>
Best wishes
|
|
|
|
|
The string object in JavaScript has a replace method, so if you need to do more than a simple replace then we'd need some details.
From http://www.w3schools.com/jsref/jsref_replace.asp[^]:
Syntax
stringObject.replace(findstring,newstring)
Parameter Description
findstring Required. Specifies a string value to find. To perform a global search add a 'g' flag to this parameter and to perform a case-insensitive search add an 'i' flag
newstring Required. Specifies the string to replace the found value from findstring
If you need to simulate the .startsWith function in JavaScript then here's an article that demonstrates how to do so using regular expressions:
http://www.tek-tips.com/faqs.cfm?fid=6620[^]
If you need to do something different then let us know.
Regards,
|
|
|
|
|
Hi, In my project I want to bind the datetime with link button in the Repeater. I print the datetime in the Repeater using Convert(varchar,cre_date,107).It It is displaying in the format of Feb 23,2009 . But it is conflicting with the Html coding of
<asp:linkbutton id="lnldat" text="<%# Eval(" cre_date=")%>" runat="server" xmlns:asp="#unknown"> .
How to display the date in that format with Link button? Can anyone help?
modified on Monday, February 23, 2009 6:29 AM
|
|
|
|
|
Use the repeater's onitemdatabound event.
Add the OnItemDataBound="Repeater_ItemDataBound" to the mark up of the repeater.
Add the following to your code behind with modifications...
protected void Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lnldat = (LinkButton)e.Item.FindControl("lnldat");
DataRowView dataRow = (DataRowView)e.Item.DataItem;
lnldat.Text = dataRow["YouColumn"].toString();
}
}
I didn't get any requirements for the signature
|
|
|
|
|
An error occured like this?
Unable to cast object of type 'System.Data.Common.DbDataRecord' to type 'System.Data.DataRowView'.
What is datarowview?
|
|
|
|
|
I wrote the coding like this.
protected void Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lnldat = (LinkButton)e.Item.FindControl("lnldat");
DataRowView dataRow = (DataRowView)e.Item.DataItem;
lnldat.Text = dataRow["cre_date"].ToString();
}
}
And i got the error
Unable to cast object of type 'System.Data.Common.DbDataRecord' to type 'System.Data.DataRowView'.
when the form is load?
|
|
|
|
|
My fault. If you use a datatable the object is datarowview. If you use a datareader the object is dbdatarecord. just replace datarowview with dbdatarecord.
protected void Repeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lnldat = (LinkButton)e.Item.FindControl("lnldat");
dbdatarecord dataRow = (dbdatarecord)e.Item.DataItem;
lnldat.Text = dataRow["cre_date"].ToString();
}
}
I didn't get any requirements for the signature
|
|
|
|
|
It has the following error..
The type or namespace name 'dbdatarecord' could not be found (are you missing a using directive or an assembly reference?)
|
|
|
|
|
System.Data.Common.DbDataRecord
I didn't get any requirements for the signature
|
|
|
|
|
The following error came?
The type or namespace name 'dbdatarecord' could not be found (are you missing a using directive or an assembly reference?)
Where to add this line? Please explain briefly?
|
|
|
|
|
replace dbdatarecord with System.Data.Common.DbDataRecord
I didn't get any requirements for the signature
|
|
|
|
|
Can some body tell me how to implement one to one chat in Asp.net application like gmail. I simply can not figure out any solution. I tried to google this but everything I am getting is group chat like chat room. I need one to one chat. Like when you login to the application it will show the list of users online. Click on one user to chat with him/her only. Any kind of help will be appreciated.
Plz plz plz help me....
Sagar Pattnayak
Software Developer
Sun-Dew Solutions
+91-9831169962
|
|
|
|
|
Hi all, I have the same question here. I am trying to build a chat application for my webpage. What i need to do have is implement private chat. So far i have done the chat application using a database and using a timer which checks every 3-5 secs to refresh the messages.
My question is :
I need to eliminate the use of timer and want to implement it as a condition. i.e only if the user enters a chat into the box should the other person refresh his text box and it shouldnt be run on a timer. Is it possible? Please help.
|
|
|
|
|
Hi
How can I implement weather API of http://www.accuweather.com
in website.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
trilokharry wrote: How can I implement weather API of http://www.accuweather.com
With code?
I didn't get any requirements for the signature
|
|
|
|
|
Hi my gridview in inside the update panel..
then also my events are getting postback , whas the probs? y update panel is not working for me?
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Member 3879881 wrote: Hi my gridview in inside the update panel..
then also my events are getting postback , whas the probs? y update panel is not working for me?
I didn't get your problem. If your control is inside the Updatepanel, then that part will take part in the post back. Then what is your problem ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi Jana thansk for ur reply,
My problem is if we mention anything in updatepanel control , the page wont get postback...,
But for me its getting postback...,
This is what my prob...,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Which control event are your firing for post back ? Is it inside Update panel or outside of update panel ? Can you please put those line of code over here.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
My Gridview is inside the update panel ...,
I have sorting and paging on it...,
Both the things getting postback...,
SAmple code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="UsualVolUp" CellPadding="0" CellSpacing="0" AutoGenerateColumns="False"
runat="server" Width="100%" GridLines="None" OnRowCommand="UsualVolUp_RowCommand"
OnRowDataBound="UsualVolUp_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Change (Rs.)" HeaderStyle-CssClass="GridHeadC Rborder"
ItemStyle-CssClass="GridDataR Rborder" ItemStyle-Wrap="False" ItemStyle-VerticalAlign="middle">
<HeaderTemplate>
Change
<br>
(Rs.)
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="netchg" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Volume <br> (000's)" HeaderStyle-Wrap="true"
ItemStyle-CssClass="GridDataR_Alt Rborder"
ItemStyle-VerticalAlign="middle" ItemStyle-Wrap="true" HeaderStyle-CssClass="GridHeadC Rborder"
HeaderStyle-ForeColor="#ffffff" SortExpression="Vol_Traded">
<HeaderTemplate>
<asp:LinkButton CssClass="blcktxt" ID="lnkbtnVol_Traded" runat="server" CommandArgument="Vol_Traded" CommandName="Sort">Volume <br> (000's)</asp:LinkButton>
<asp:PlaceHolder ID="placeholderVol" runat="server"></asp:PlaceHolder>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Volume" runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Width="25%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Diff (000's) " HeaderStyle-CssClass="GridHeadC Rborder"
ItemStyle-CssClass="GridDataR Rborder" ItemStyle-Wrap="False" ItemStyle-VerticalAlign="middle">
<HeaderTemplate>
Diff
<br>
(000's)
</HeaderTemplate>
<ItemStyle CssClass="GridDataR Rborder"></ItemStyle>
<ItemTemplate>
<asp:Label ID="Diff" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView></td></tr>
<tr id="PrevNext" runat="server">
<td align="right" colspan="5">
<asp:LinkButton ID="prev" runat="server" OnClick="Lower_PrevClick" Text="Prev" CssClass="PagerLink1"></asp:LinkButton>
<asp:LinkButton ID="next" runat="server" OnClick="Lower_NextClick" Text="Next" CssClass="PagerLink1"></asp:LinkButton>
</td>
</tr>
<tr id="TR_NoData" runat="server" visible="false">
<td colspan="5" class="Nodata" align="center">
No Data Found</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Member 3879881 wrote: <asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">UpdateMode="Conditional">
Why did you make UpdateMode="Conditional" ? .
Did you call UpdatePanel1.Update() from any where of you code ?
If you change the UpdateMode from Always to Conditional, you need to call Update() method Explicitly for Update that Panel. And I think this is the reason .
Try to Make it "Always" Or if you don't need it to postback always, Just call UpdatePanel1.Update() while Paging and Sorting from Codebehind. That will resolve your problem.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi if i didnt give updatemode its default value always...,
Then also i am getting postback only...,
Sample i have created one form in my webapplication
In side my update panel one textbox and one button is there...,
wHEN I Click the button the textbox will get text as "hi"...,
This one also getting postback...,
whats teh excat probs?, im't getting...,
In my server system i have installed framework 2.0 and ajax extension...,
y its getting postback for the button click event
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Hello Brothers pls helpme,
I want to create bogagregator site .
users can update blog'posts or url and title.
usres can rerieve it (title) as links from database to gridview .
How can i make titles are the links of posts(urls)
here is the code:
<>
&lt;asp:GridView ID="GridView1" runat="server" CellPadding="4" Font-Bold="True" Font-Names="Courier New"
Font-Size="13pt" ForeColor="#333333" GridLines="None" Style="z-index: 119; left: 17px;
position: absolute; top: 422px" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"&gt;
&lt;FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt;
&lt;RowStyle BackColor="#CCCCFF" ForeColor="#333333" /&gt;
&lt;EditRowStyle Font-Bold="True" ForeColor="#804000" /&gt;
&lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /&gt;
&lt;PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /&gt;
&lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt;
&lt;AlternatingRowStyle BackColor="White" /&gt;
&lt;Columns&gt;
&lt;asp:BoundField DataField="title" HeaderText="title" SortExpression="title" /&gt;
&lt;asp:BoundField DataField="url" HeaderText="url" SortExpression="url" /&gt;
&lt;asp:BoundField DataField="languages" HeaderText="languages" SortExpression="languages" /&gt;
&lt;asp:BoundField DataField="categories" HeaderText="categories" SortExpression="categories" /&gt;
&lt;asp:BoundField DataField="description" HeaderText="description" SortExpression="description" /&gt;
&lt;asp:BoundField DataField="author" HeaderText="author" SortExpression="author" /&gt;
&lt;asp:BoundField DataField="city" HeaderText="city" SortExpression="city" /&gt;
&lt;asp:BoundField DataField="country" HeaderText="country" SortExpression="country" /&gt;
&lt;asp:BoundField DataField="date" HeaderText="date" SortExpression="date" /&gt;
&lt;/Columns&gt;
&lt;/asp:GridView&gt;
|
|
|
|