Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

gently caress them posted:

I wanted for some javascript (jquery datatables) on my page to be able to call /api/controllername and get json from it.

I meant to say the webapi project's controller object isn't something I can reference from my web page. The two separate projects didn't work. Trying to do it all in one project didn't work.

So you're call something like $.get('/api/controllername',...) on your webpage, and it won't hit the api, but if you directly put in "http://somethingbutts.jp/api/controller" in the browser, that works?

Adbot
ADBOT LOVES YOU

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
I'm going to start over and state my issue and desired solution from scratch so I don't go completely insane. Because I already feel that I'm about to just start breaking things.

I don't know poo poo about asp.net forms. I've done MVC on a project with knockout holding everything together and had controllers just firing off json. I used very little razor. I was part of a team, the project was well architected, we used source control (WOO!) and it was generally nice. I picked up and went right along. I just wish management and HR where I worked wasn't poo poo and I could have stayed.

Right now I'm completely on my own and I've gleaned that we basically just host individual web pages and start from an empty template.

My attempts at taking what I knew and combining it with web forms has been an exercise and mashing my face into something resembling a pug dog. I'm done wasting time and watn to figure out how to do this right

All I want to do is take data from a database and get a searchable, paginated table out of it. For whatever reason I've spent days just chasing my tail like a moron. I try to look online at how to do this and I see poo poo from 2003. It's 2014 and I'd like to think there's a sane way to do this.

I looked at the spaghetti poo poo that is how we do it in the existing way. I see a mess of code behind and <%eval%> poo poo and my eyes popped out of my head. Sr. Dev was here on one of his odd days in and said "it's bad, we had like 3 interns do it over and over, just re do it." He then disappeared again.

So in TYOOL 2014 how do I do this without trying to mix and match different versions of .NET and different idioms from over a decade? What's the current, correct way to do this in forms?

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

Drastic Actions posted:

So you're call something like $.get('/api/controllername',...) on your webpage, and it won't hit the api, but if you directly put in "http://somethingbutts.jp/api/controller" in the browser, that works?

I just give the gently caress up. I just want one clear clean way to do that that's documented top to bottom. I know where the DB is. I can touch the DB.

But I don't know poo poo about forms or old asp anything, apparently.

Edit: I've never even seen $.get() before in use, anyway. I'm flying blind and just throwing together a mish mash of methods I don't know is making me go crazy.

Double Edit: The fact that there are dozens of ways to do anything with web poo poo is what's so frustrating. There's no one correct way, and the only thing I've seen where I work is admittedly poo poo. There's no clear way to see what the current or recommended idiom for anything is. I see tutorials with jquery here, or EF there, or some shambling monster of code behind and $.get() and all sorts of bad practice with "Well we're on gigabit intranet so it's OK to hit the table every time someone types a key and do a walk along search!" sprinkled on top by the only other developer who is also not even here.

When I realized what I was getting into was NOT what the interview led me to believe I've had a lot of people say "heh just gtfo" and I probably should have already. I guess I have to just cargo cult poo poo and hope for the best before I split just like the last few people who sat at this desk.

Fuck them fucked around with this message at 17:36 on Jul 28, 2014

RangerAce
Feb 25, 2014

gently caress them posted:

I wanted for some javascript (jquery datatables) on my page to be able to call /api/controllername and get json from it.

I meant to say the webapi project's controller object isn't something I can reference from my web page. The two separate projects didn't work. Trying to do it all in one project didn't work.

But since I'm apparently trying to learn about 5 different ways of doing something on asp since I'm working alone and trying to take my MVC knowledge and match it with this workplace's old-hat asp stuff and it's making me mash my face as flat as a pug while the only other programmer here comes and goes like a drat housecat I'm just going to copy/paste from a tutorial until I get my poo poo working then do tutorials to look busy.

What really kills me is I'm allowed to waste so much time here. There's no accountability and I'm not really sure a year from now me (or a few years from now me) would want me to spend the time to learn how to do poo poo from 2003.

Well, here's how we do it. Not that this is the One True Way, or anything, but maybe it will give you some ideas.

We have a class library with ALL our business logic in it. We set this up way back when we were still using ASMX web services. The ASMX classes contained one line methods that were wrappers around out class library methods. Eventually we replaced the ASMX services with a WCF Service project. EZ PZ. Today, we set up a Web API 2 project. Same thing, the controller actions in the ApiController classes are just wrappers around our class library methods. Get all of your business logic out of the service layer and client layers, so that your controllers are skinny. Fat controllers are kind of a trap, in my book.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

RangerAce posted:

Well, here's how we do it. Not that this is the One True Way, or anything, but maybe it will give you some ideas.

We have a class library with ALL our business logic in it. We set this up way back when we were still using ASMX web services. The ASMX classes contained one line methods that were wrappers around out class library methods. Eventually we replaced the ASMX services with a WCF Service project. EZ PZ. Today, we set up a Web API 2 project. Same thing, the controller actions in the ApiController classes are just wrappers around our class library methods. Get all of your business logic out of the service layer and client layers, so that your controllers are skinny. Fat controllers are kind of a trap, in my book.

That's how I've always done any sort of service, FWIW.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
Well I grit my teeth and did this tutorial and don't understand a drat thing. But it Just Works™ with the actual data from the actual DB, so there's that. I hate having magic behind the scenes do things for me, but hey, whatever, I did it.

My big question was more about "should I use asp controls to make the table and sort and search it" vs "should I just json the stuff and use data tables" and with regards to that should I do server side or client side filtering.

I think my uneasiness about doing it the way I actually know how to and learned from my prior job is because here it's all spaghetti .net 2.0 and I don't want to be johnny come lately turning poo poo on its head. I don't want to be the next HOW.

I can't even talk to the sr dev to ask if he likes a thing, it just ends up at the desk of the non-technical manager who either yays or nays it. Then again I'm the only one here right now.

wwb
Aug 17, 2004

nthing the "build offline services" suggestion -- that really is the way to fly. Been through similar re-wrapping of POCO stuff several times, works great.

Like I previously said, if this is a HTTP GET-only "read this data" thing embedded in a legacy project then you can every easily use a straight .ashx handler here on legacy versions of .NET. IHttpHandlers are the basic building block of the .NET web pipeline, at least the legacy bit. It gets you down to "given a request to this url spit back this data".

How to get there is pretty easy -- just add a new generic http handler to the project, do stuff in the process request method it gives you.

epswing
Nov 4, 2003

Soiled Meat

gently caress them posted:

I just give the gently caress up.

Double Edit: The fact that there are dozens of ways to do anything with web poo poo is what's so frustrating. There's no one correct way, and the only thing I've seen where I work is admittedly poo poo. There's no clear way to see what the current or recommended idiom for anything is. I see tutorials with jquery here, or EF there, or some shambling monster of code behind and $.get() and all sorts of bad practice with "Well we're on gigabit intranet so it's OK to hit the table every time someone types a key and do a walk along search!" sprinkled on top by the only other developer who is also not even here.

Ah the wonderful world of web development.

I've gone back and forth a few times from writing primarily desktop software to writing primary web software (VB/access -> PHP/mysql -> Python/TK -> java/tomcat/postgres -> xquery -> C#/WPF -> ASP.NET/sqlserver). Each shift involved learning an entirely new technology stack and each time it was Something Awful (tm). I've come to realize over the years that part of the reason why it was awful is because I carried my assumptions from one platform to the next, and I really shouldn't have. At those times I have "but I just want to XYZ" on the tip of my tongue, and it's just never, ever that simple.

It's a bit like why there's so much hate for javascript, because people see the C*/Java syntax and assume it works a certain way, and when it doesn't they get mad. If one takes the time to learn from scratch with no assumptions, most reasonable people would see it's a neat language.

Yes, web is frustrating, you need to know 3 languages before you can even do anything productive and most "tutorials" are absolute poo poo. Just keep at it, make fewer assumptions, learn the important bits from scratch, and eeeeeverything will be OK :sympathy:

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

epalm posted:

It's a bit like why there's so much hate for javascript, because people see the C*/Java syntax and assume it works a certain way, and when it doesn't they get mad. If one takes the time to learn from scratch with no assumptions, most reasonable people would see it's a neat language.

I've been using NodeJS for a few apps and I love it. It's so powerful, and the fact it's all running on Javascript is kinda weird and really cool. But in terms of style it's very very different. It is really cool though seeing what it can do though.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Bognar posted:

complete lack of syntax support (even through plugins) in Visual Studio for JSX.

.NET devs who want to +1 in the name of progress on this front can do so here: http://webessentials.uservoice.com/forums/140520-general/suggestions/4935998-add-reactjs-jsx-support

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Knyteguy posted:

How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in?

Code snippets, but a common library makes a lot more sense. Especially if you version it and reference it in dependent projects out of Nuget.

ljw1004
Jan 18, 2005

rum

Knyteguy posted:

How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in?

I blog about it! Or write a codeproject article. That's been my most reliable way to re-use code over the past twenty years...

Mr. Crow
May 22, 2008

Snap City mayor for life

Knyteguy posted:

How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in?

Common libraries, and I have a common personal repo I threw up on github with my own libraries and junk I develop and want to keep track of.

If probably blog about it if I had one but :effort:

wwb
Aug 17, 2004

Knyteguy posted:

How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in?

I would blog about it but that would require having a blog.

We just statically include the code in projects in general here if it is just little utility functions. We've been down the path of a standard library and it ends up getting bloated and fugly fast. You also take on versionsing issues as oftentimes things need slightly different implementations. Add to that the ease of debugging statically included code versus a library and the decision is easy.

Nuget makes one think it would be easy to manage the external dependency and that is true -- at least for stuff that grows from "random function" to "small library" -- but it really does not solve the versioning issue. Keeping snippets in a repo makes sense though, for the most part we just go grab the code of the the other project to start with and modify from there.

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


In the diff application I'm trying to write in WPF, I have two bool arrays, RowDifferent[RowCount] and ColumnDifferent[ColumnCount]. In the DataGrids displaying the data I'm diffing, I want the following style:

- If RowDifferent[cell's row number] XOR ColumnDifferent[cell's column number], color background light pink
- Else If RowDifferent[cell's row number] AND ColumnDifferent[cell's column number], color background deep pink

I know I have to use a style datatrigger, somehow, but I'm not really sure how to bind the trigger to an array of data. Any thoughts?


(Sorry I can't paste the XAML here, work computer's not on the internet. :()

Sedro
Dec 31, 2008

Blinkz0rz posted:

So I'm using ReactiveUI to build a WPF application and I'm stumped. I'm trying to link the selected value of a listview to an observable property and then trigger a ReactiveCommand.

How do I do this? Reactive's docs are lacking, to say the least.
Here's an example

C# code:
using System.Reactive.Linq;

// an interface for the main view-model
public interface IViewModel
{
    IList<ItemViewModel> Items { get; }
    ItemViewModel SelectedItem { get; set; }
    ICommand Command { get; }
}

// main application view-model with a list of things
public class ViewModel : ReactiveObject, IViewModel
{
    public ViewModel()
    {
        items = new ReactiveList<ItemViewModel>
        {
            new ItemViewModel { Value = "foo" },
            new ItemViewModel { Value = "bar" },
        };

        // Require that something is selected
        var canExecute = this.ObservableForProperty(x => x.SelectedItem).Select(x => x != null);
        command = ReactiveCommand.CreateAsyncTask(canExecute, async o =>
        {
            // simulate delay
            await Task.Delay(TimeSpan.FromSeconds(2));

            MessageBox.Show("Done!");
            return Unit.Default;
        });
    }
        
    readonly ReactiveList<ItemViewModel> items;
    public IList<ItemViewModel> Items
    {
        get { return items; }
    }

    ItemViewModel selectedItem;
    public ItemViewModel SelectedItem
    {
        get { return selectedItem; }
        set { this.RaiseAndSetIfChanged(ref selectedItem, value); }
    }

    readonly ReactiveCommand<Unit> command;
    public ICommand Command
    {
        get { return command; }
    }
}

// view-model representing an item in the list
public class ItemViewModel
{
    public string Value { get; set; }
}
XAML
XML code:
<Window
    x:Class="ReactiveUITest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:myapp="clr-namespace:ReactiveUITest"
    Title="MainWindow" Height="350" Width="525"
    >
    <Window.DataContext>
        <!-- Instantiating the view model in XAML, because I can -->
        <myapp:ViewModel/>
    </Window.DataContext>

    <StackPanel>
        <ListBox
            ItemsSource="{Binding Path=Items, Mode=OneTime}"
            SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}"
            DisplayMemberPath="Value"
            />
        <TextBlock>
            <Run Text="Selected:"/>
            <Run Text="{Binding SelectedItem.Value}"/>
        </TextBlock>
        <Button Content="Clicky" Command="{Binding Path=Command}"/>
    </StackPanel>
</Window>

crashdome
Jun 28, 2011
Anyone use Xamarin? Client is looking to get a native framework supplied both for iOS and Android development into an app for both platforms and setting up two development environments for the same project seems cumbersome.

Volte
Oct 4, 2004

woosh woosh

crashdome posted:

Anyone use Xamarin? Client is looking to get a native framework supplied both for iOS and Android development into an app for both platforms and setting up two development environments for the same project seems cumbersome.
I'm using it for exactly that and it's basically the best thing ever, as long as you can afford the price tag (or can get the student discount). Definitely look at MvvmCross, and avoid Xamarin.Forms since it is still basically alpha-quality software despite the production status.

crashdome
Jun 28, 2011
Good to hear. Think I could get away with the free IDE for a demo? I'm sure if the demo was successful, the $999/year would be a drop in the bucket for the planned product development.

Volte
Oct 4, 2004

woosh woosh

crashdome posted:

Good to hear. Think I could get away with the free IDE for a demo? I'm sure if the demo was successful, the $999/year would be a drop in the bucket for the planned product development.
I don't really know how the free tier scales, since I think it has size limitations (i.e. it will fail if the compiled binary is too big), but it's worth checking out at least. There is a 30-day trial of the business version though if you think you could get the demo done in that length of time, but the compiled apps only run for 24 hours.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Volte posted:

I'm using it for exactly that and it's basically the best thing ever, as long as you can afford the price tag (or can get the student discount). Definitely look at MvvmCross, and avoid Xamarin.Forms since it is still basically alpha-quality software despite the production status.

I'm using Xamarin + MvvmCross on a sizable education-related project right now and I've been really impressed at how well it all works together. If you want to learn MvvmCross, definitely take a look at the N+1 series of videos by the creator/maintainer of the project.

Regarding the demo version, I don't really know how capable it is since we just dove in and bought a subscription. So far, though, it's been completely worth it.

crashdome
Jun 28, 2011
I think that's possible. It looks amazing! Definately disappointed by the limitations of the free version but, the trial should be sufficient. I'll definitely make use of the 30 days for sure. Just realized it's $999 PER platform. Ugh.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
I fell into a JS framework hole... I threw out knockout and redid my thing in angular. Knockout is more familiar to me as an MVVM user, but Angular is a lot easier.

Volte
Oct 4, 2004

woosh woosh

crashdome posted:

I think that's possible. It looks amazing! Definately disappointed by the limitations of the free version but, the trial should be sufficient. I'll definitely make use of the 30 days for sure. Just realized it's $999 PER platform. Ugh.
There is strong reason to believe that Xamarin will be part of Visual Studio in the not too distant future, so there's still hope.

Dietrich
Sep 11, 2001

You ever finish something really complex and want to throw up your hands and cackle "It's alive!!" the first time it runs?

Ochowie
Nov 9, 2007

Volte posted:

There is strong reason to believe that Xamarin will be part of Visual Studio in the not too distant future, so there's still hope.

Yep. There were some acquisition rumors in the spring. Nothing recently though but it would make sense. I wonder if they'll include it in the base Visual Studio license or it will still be a additional license to buy.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Dietrich posted:

You ever finish something really complex and want to throw up your hands and cackle "It's alive!!" the first time it runs?

I usually just get worried about which obvious thing I might have screwed up this time.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Volte posted:

There is strong reason to believe that Xamarin will be part of Visual Studio in the not too distant future, so there's still hope.

Looking forward to a $1600 VS 2015!

Side note, someone in the oldie thread seems to want to quit his job because they've decided to move to xamarin. If you people like it he may benefit from hearing so.

crashdome
Jun 28, 2011
In my VERY brief attempt to play with Xamarin, it seems slick. I hold my breath though.

I have read forums where people talk about using Unity as a cross-platform LoB tool and cringe.

Seems like it is also a better tool than "we'll just throw up a web server and trust cross-platform compatibility to the browsers"


Newf posted:

Looking forward to a $1600 VS 2015!

Lol. Or that $150/month/developer/platform/number of toes you have subscription fee*


*Xbox achievement unlocked if you are polydactyl!

RICHUNCLEPENNYBAGS
Dec 21, 2010

Dietrich posted:

You ever finish something really complex and want to throw up your hands and cackle "It's alive!!" the first time it runs?

No, not until it produces results that are close to what I intended. :)

RICHUNCLEPENNYBAGS fucked around with this message at 01:08 on Aug 3, 2014

Mr Shiny Pants
Nov 12, 2012

RICHUNCLEPENNYBAGS posted:

No, not until it produces results that are close to what I intended. :)

This.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
So I've just bitten the drat bullet and learned a little asp. I don't much like the magic of all these tags just magically doing poo poo for me when my past experience of ko/jQuery and some controller actions was so easy to learn and debug, but it's mostly working now. I've just got a few "WTFs" left.

SearchExpressions don't much like to search on an integer column. Do I really need a CustomExpression? WTF? I've gone through the API wondering what the magic incantation of "cast it to an int" is and have yet to find it. Do I need some property to say "hey, pass an int into the magic SQL you're generating" or is it worse than that?

I'm also wondering how to handle date columns. There's some datepicker hiding somewhere.

The users like a "walk along search", that is, as you type, every lift of your key makes the current string in the searchbox fire a search event. Right now this is done with an incomprehensible mishmash of codebehind, <%eval%> magic, and $get() from the ajaxtoolkit I confused with jQuery for a long time. And their own custom gridview that was opaque and undocumented. And reams of commented out code.

So, if my understanding is correct, I just want some magic to basically click the search button/fire that event for me whenever someone puts a character into any search field on the page, what's the most sensible, understandable, maintanable manner to do this?

I should add the Senior Dev is not present right now, but I did finally grab his ear and get a bit of a walkthrough of what this undocumented custom stuff actually is and see some of their idioms. I showed him some samples of the ko/jquery/controller action/MVVM stuff I did from the last job and his eyes lit up. So, maybe this will only be a maintenance issue when the non technical managers decide to get away from this aspshit.

:yotj: at least I'm being offered full time, since I'm persistent about actually trying. But the pile of "WTF" the past few contractors who came and went have left me is really, really grueling to figure out.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

gently caress them posted:

The users like a "walk along search", that is, as you type, every lift of your key makes the current string in the searchbox fire a search event. Right now this is done with an incomprehensible mishmash of codebehind, <%eval%> magic, and $get() from the ajaxtoolkit I confused with jQuery for a long time. And their own custom gridview that was opaque and undocumented. And reams of commented out code.

I'm currently enjoying great success with this sort of thing via selectize. I'm using it as a configuration tool, and it was really easy to attach ajax events to the menu so that it updates my model on the fly. The below attaches to a <select id="AvailablePortfolios"> element that gets populated server-side by an ASP:ListView, and makes a real nice, user-friendly menu for selecting the different portfolios.


JavaScript code:
$('#AvailablePortfolios').selectize({
        onItemAdd: function(value, $item){
            
            $.ajax(
            {
                type: "POST",
                url: "Vessel.aspx/VesselAddPortfolio",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ vessel: $('.haspID').text(), portfolio: value })
            });
        },
        onItemRemove: function(value){
            
            $.ajax(
            {
                type: "POST",
                url: "Vessel.aspx/VesselRemovePortfolio",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ vessel: $('.haspID').text(), portfolio: value })
            });

        }
    });

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
That's not quite what they want. They want the grid that shows search results (paged, to boot, since until you put anything into the text boxes for search strings it returns the entire table from the db) to update on each and every keystroke.

Looks good, though.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
For that level of responsiveness I think client-side solutions are worth checking out. tinysort is a pretty rad js library for sorting dom elements via custom search functions (which can be attached to the keyup event of your favorite search box). Bottom of the page there has it working with a table.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
They're pretty big on doing things with their asp.net controls. Which is why the codebehind/aspgridviewautogeneratedwtf/ajaxcontrol $get(<%EVAL LOL%>) monster was there in the first place.

I'd just as soon json the entire table and sort it client side.

The thing is, the non technical bosses are saying "bla bla no mvc use forms :frog:" so I might just do a jQuery table and just style it like what the gridview generates.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Newf posted:

For that level of responsiveness I think client-side solutions are worth checking out. tinysort is a pretty rad js library for sorting dom elements via custom search functions (which can be attached to the keyup event of your favorite search box). Bottom of the page there has it working with a table.

I'll reiterate tinysort is really good at this. We've implemented it literally dozens of times.

Also thanks in general to everyone else for the Xamarin talk too; we're thinking of taking the plunge on it so it's good to hear from people who have experience with it.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
This really is getting kind of old. I have a query extender containing search expressions to search by any given column in a grid view table. If I want to search by columns which are of type int, I get an error of parameter type being wrong. In the control parameter if I say DbType="Int32" it still just shits itself.

Is this because the column is nullable? If it is, how do I fix that?



code:
    <asp:QueryExtender runat="server" TargetControlID="LinqDataSource1">
        <asp:SearchExpression SearchType="Contains" DataFields="OrderNumber">
            <asp:ControlParameter ControlID="OrderNumberSearch" />
        </asp:SearchExpression>
        <asp:SearchExpression SearchType="Contains" DataFields="OrderName,OrderTitle">
            <asp:ControlParameter ControlID="OrderTitleSubjectMatterSearch" />
        </asp:SearchExpression>
        <asp:SearchExpression  DataFields="Book">
            <asp:ControlParameter ControlID="BookNumSearch" DbType="Int32" />
        </asp:SearchExpression>
        <asp:SearchExpression DataFields="Page">
            <asp:ControlParameter ControlID="PageNumSearch" DbType="Int32" />
        </asp:SearchExpression>
        <asp:SearchExpression SearchType="Contains" DataFields="ClerkFileDate">
            <asp:ControlParameter ControlID="DateFiledSearch"  DbType="DateTime"/>
        </asp:SearchExpression>
        <asp:SearchExpression SearchType="Contains" DataFields="OrderSigned">
            <asp:ControlParameter ControlID="DateSignedSearch" DbType="DateTime" />
        </asp:SearchExpression>
    </asp:QueryExtender>

 <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="AdminOrdersDataContext" EntityTypeName="" Select="new (OrderNumber,
 OrderName, OrderTitle, FileName, Page, Book, ClerkFileDate, OrderSigned)" TableName="tblAO_Indexes">
    </asp:LinqDataSource>
I am so green and new to ASP.net web forms I feel like I'm back in school, ugh. Why is it so hard to search for matching ints in a column?

Edit: no more breaking tables!

Edit2: CustomExpression should let me do this. Do I inline stuff on the .aspx page or do I put it in the code behind? I've heard lots of voices saying "NEVER USE CODE BEHIND" so I'd like to do this right. I don't want to just recreate the same monster as before.

Fuck them fucked around with this message at 21:57 on Jul 31, 2014

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Is this an internal app or a public facing one? A lot of the "never use code behind" is because of speed concerns, AXD chicanery, etc. I don't really get the hate for it myself; I've built enterprise scale sites (e.g. 1 million uniques a day) that use code-behind and not really had a problem with it. There's some session management and program flow gotchas, but once you learn to work around them it's really not a big deal.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply