I have my repeater item template:
<ItemTemplate>
<tr><td><%#Container.DataItem("Category")%></td></tr>
</ItemTemplate>
Hooked up to:
s = "SQL that works ok on server"
x = New SqlCommand(s, c)
x.Parameters.Add("@contentid", SqlDbType.Int)
x.Parameters("@contentid").Value = contentid
c.Open()
r = x.ExecuteReader
If r.HasRows Then
Linksrepeater.DataSource = r
Linksrepeater.DataBind()
End If
c.Close()
r.Close()
When I run the code I get: Invalid Cast Exception was not handled by user code (Conversion from string "category" to type 'Integer' is not valid.)
I'm not sure how / why it is trying to convert "Category" to integer as in the db it is a string.
Can you please tell me how to avoid this error? thanks.
Hi, I have a strange problem happening today. I am running the latest version of the MVC V2 framework and have been having no trouble at all - I came in this morning and for some reason values aren't being passed in to actions.
To clarify lets say I have something like this:
<% using (Html.BeginForm("Register", "Registration", FormMethod.Post)) { %>
....
<input type="submit" name="register" id="register" value="Register" />
<% } %>
And in my controller I have the following:
[HttpPost]
public ActionResult Register(RegistrationModel model, string register)
{
// At this point the register string is null
}
This has been working fine for a while now and I have not changed anything that I can think of that would cause this to happen.
Does that make sense and as anyone any idea what is going on or what I have messed up?
Thanks.
the thing is that I have a form with a textbox and a button and a hidden field, now what i want to do is to write something in the textbox ,pass it to the hidden field and then access that thing written in the hidden field in the controller . how can i do that?
I have implemented ajax on paging but my problem is when i navigate on paging and go to page 1 then on page 2 after that if i press backspace it went to the last page from where it comes instead of going to page 1. I want to know how should i implement paging like stackoverflow have. Further i have noticed that my url doesnt change on paging it remains like Home/Index when im on 1st page or 2nd page or any other page?
I need to create a custom route to list all the rooms in a given building. So, I want the url to look something like this:
/Building/1000/Room
Which would list all the rooms in Building 1000.
Is this the correct mapping for the route (to call the IndexByBuilding method in RoomController)?
routes.MapRoute(
"RoomsByBuilding",
"Building/{id}/Room",
new { controller = "Room", action = "IndexByBuilding", id = "" }
);
I've been using my own Error reporting module which was combination of simple c# and jQueryUI Dialog. Problem is that once error or success occurs i do write it's value to session. It does work pretty good on pages with Responce.Redirect on error but not on pages where i catch an error and then return to same form.
My question is why does session which added pre-postback fails to load in pages where i have return statement on some condition.
And if there another way to save errors and success message except in session ? Maybe global variables or something like that ...
In my web.config file i have the following code:
<system.web>
<assemblies>
<authentication mode="Forms">
<forms loginUrl="/Account/Login" slidingExpiration="true" timeout="1" />
</authentication>
<sessionState timeout="1"></sessionState>
</assemblies>
</system.web>
And I have main page Project and in that there will sub pages. I have given the [Authorize] attribute for each view index method.
After the session complete when we select any view then the page inside the project main page will be redirecting. But I want the whole page to be redirected.
Any Help is appreciated.
Hi,
I need to run a javascript function when the update panel is loaded completely(I want to scroll), and not on initial page load.
Please suggest.
Thanks
I bind custom DataTable to DataGrid through ObjectDataSource, where i use SelectMethod and UpdateMethod. SelectMethod working great, but when I try to update row it's breaking by MissingMethodException. What should i do to fix this problem?
Sorry for my bad english ;)
I'm passing query string parameter to .aspx page with 'Ñ' character in value.
But Request.QueryString returns some other box '[]' character in return.
I think this request encoding issue. and I do not want to use that HttpUtility.UrlDecode and HttpUtility.UrlEncode methods.
Does anyone know how to solve this?
On my master page I have:
<link rel="stylesheet" href="css/default.css" />
I also have a page "blog.aspx" in the root directory.
I have the rule:
<rewrite url="~/blog/blog.aspx" to="~/blog.aspx" />
My questions are:
Am I meant to make all my links in my site point to blog/blog.aspx now instead of just blog.aspx where it is physically located
How is best to cope with the paths of the stylesheets etc now being messed up because they are one dir up?
Hi,
I have a textbox and a regular expression validator applied to it. I want to make sure that the only allowed string inputted into the textbox are "Anything Entered" or "Something Else" or "Another String" otherwise I want an error to be displayed.
This is the regular expression I have so far:
ValidationExpression="(^Anything Entered)$|(^Something Else)$ |(^Another String)$"
However when I enter the supposed valid strings the error is displayed. I cant figure out whats wrong with the expression. Any help would be greatly appreciated.
Thanks,
Zaps
I have:
tXML = "<type p_type=\"All\"/>";
if I do
Response.Write(tXML);
I get a blank space.
Is there anyway to output this string so I know it is being created?
I have two pages page1.aspx and page2.aspx, both have code behind with partial classes.
How do i access public property message on page1.aspx from page2.aspx ?
public string message { get; set; }
Currently i am working on project in which login user control is there in master page. earlier i had seperate login.aspx page and was able to call login method of home controller (with acceptverb = post). now we have changed the idea, want to place login control on master page (home page).
Now when i click on login button of login control - it calls login method of controller class with acceptver = get. how can i call login method with acceptverb = post?
Is there a way to express
<% objControl.ObjProp=ObjVar; %>
<my:Control ID="objControl" runat="server" />
As something like this, in one line? And without passing ObjVar as a string?
<my:Control ID="objControl" runat="server" ObjProp=ObjVar />
Hi all
I wrote a control, and use a tool to do the code analysis. There is a test that I didn't pass. Avoid excessive locals, http://msdn.microsoft.com/library/ms182263(VS.90).aspx.
In my CreateChildControls function, I built a big table with lots of field. I need to create a lot of TableRow and TableCell to construct the table. But these are not field or property of control. Thery are local variables in the function, which are created dynamically.
Should I make these TableCells and TableRows as fields of the control? Or I just keep them as the local variables in the CreateChildControl function?
Best Regards,
I've been given a task to make a dynamic drop down which takes it's data[image and value id] from table. I am wondering if any of you came across this scenario or if any one can help me out in this I need help in concept and coding. Definitely any help is appreciated.
I see the example in jquery here is the link:
http://www.marghoobsuleman.com/jquery-image-dropdown
something like this but data is coming from table.
I want to connect my Table adapter with the Oracle, for that I am preparing a sql query with the query builder. The query which is running fine in Oracle but makes syntax error with query builder.It shows unable to parse the query text. I am using case statement and joins within the query.
I am using the ToolkitScriptManager from the Ajax tool kit and I am having a problem finding my button's ID.
My ID's on my controls come back with $ symbols instead of _ symbols, like the following:
Grid$ctl06$insertButton
This obviously causes problems when attempting to find the control from the Page.Request.Form keys. I cannot seem to find the determining factor that would cause this.
Now, I know this is the name and in my source I see that the ID is with the _, so why is the Page.Request.Form showing up with the $ symbol instead? Anybody encounter this before?
Hy,
i went from this page on internet http://studiostyles.info/schemes that have a particular rendering technique, the list grow when the page is rendered. Is there anyone that can explain me how it is possible?
Thanks in advance.
F.
.When i choose item from "kategorije" new items loads to me in SUB_kategorije, but when i choose item from SUB_kategorije and when i click on button it shows me this error:
Object reference not set to an instance of an object.
Line 101: kom.Parameters.Add("@podkategorija", SqlDbType.Text).Value = SUB_kategorije.SelectedItem.ToString();
This is my source...
dod_pit.ascx
dod_pit.ascx.cs
Hi,
I'm using godaddy shared hosting, with IIS7, Integrated mode, and published up a bog standard MVC2 app to dev.lazygekko.com created with Visual Web Developer 2010.
It all works, however when any of the links are clicked, they point to dev.lazygekko.com/dev/..., dev being the folder it is pointing at.
Can anyone shed some light on what I may be doing wrong?
Many thanks.