jquery - asp.net autocomplete

http://www.eggheadcafe.com/tutorials/aspnet/18b6a1fa-a7cf-4507-84f2-15056fe65bb7/autocompletion-with-jque.aspx

ek:


  1. <script type="text/javascript">  
  2.    $(document).ready(function() {  
  3.        $("input#<%=txtKelime.ClientID %>").autocomplete('Ara.aspx').result(function(event, item) {  
  4.            $("#<%=txtGizliAlan.ClientID %>").val(item.toString().split(",")[1]);  
  5.        });  
  6. });      
  7. script>  
  8.   
  9. <form runat="server" id="form1">  
  10.     <asp:textbox id="txtKelime" runat="server">  
  11.     <asp:textbox id="txtGizliAlan" runat="server" style="display:none">  
  12. asp:textbox>asp:textbox>form> 


linq to sql - [error] row not found or changed

I solved this error by redragging over a table from the server explorer to the designer and re-building. So indeed, the designer was out-of-synch with the actual SQL Table.

http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/c672c8ee-bf2a-41b4-bb8b-aa76cc5d9b95/

How to copy data off your Zune

Figured this out earlier today:

I highly recommend backing up these registry values before modifying anything. If you don’t know how to do that, I don’t recommend that you even attempt this right now =)

Make sure your Zune is not plugged in and your Zune software isn’t running
open up regedit by going to the start menu and selecting “run”. Type regedt32 and hit “OK”
Browse to HKEY_LOCAL_MACHINE\System\ControlSet001\Enum\USB\
Search for “PortableDeviceNameSpace”. This should be contained in the Vid_####&Pid_####\########_-_########_-_########_-_########\Device Parameters within the above …\USB\ The ##’s listed here will be numbers and letters specific to your Zune
Change the following values:
EnableLegacySupport to 1
PortableDeviceNameSpaceExcludeFromShell to 0
ShowInShell to 1
Plug in your Zune, and make sure the Zune Software starts up.
Hopefully at this point you can open up “My Computer” and browse your device, though it does NOT show up as a drive letter.
Right now I can access it both as a harddrive and sync through the Zune Software.

[Edit: This was first posted here and ZuneBoards.com after I figured it out. For more information, check out ZuneBoards.com!]

http://phaleux.com/?p=8

asp.net - türkçe karakter sorunu


ASP.Net ile kod yazmaya başlamadan önce yaşamanız muhtemelen olan bir sorunu şimdiden çözelim. Kod yazmaya geçtiğinizde muhtemelen sayfanızda kullandığınız kontrollerde Türkçe karakterlerin yok olduğunu göreceksiniz. Bu yüzden önce bu durumdan nasıl kurtuluruz onu görelim ondan sonra kod yazmaya geçeceğiz…

   Ancak isterseniz kısa biraz bilgi verelim.ASP.Net’in tanımlı karakter kodlama tekniği UTF-8’dir yani siz aşağıdaki ayarlamalardan hiç birini yapmazsanız ASP.Net varsayılan ayar olan UTF-8’i kullanacaktır. İşin güzel tarafı eğer UTF-8 kullanılırsa sayfanıza Türkçe karakterler görebilirsiniz ve hiçbir ayar yapmanıza gerek yoktur; fakat işin kötü tarafı kullandığınız metin editörünüzün UTF-8’i desteklemesi lazım. Eğer bu kodlamayı desteklemeyen bir editör kullanırsanız, editörünüz kodlarınızı ANSI formatında kaydeder ve sizin karakterleriniz yok olur gider…

   Eğer siz UTF-8’i desteklemeyen bir editör kullanıyorsanız (örn:Homesite 4.5) ve Türkçe karakter sorunu yaşamak istemiyorsanız o zaman bütün web tasarımcılarının aşina olduğu bir karakter kodlama yöntemini kullanacağız ISO 8859-9 kodlaması. Bu kod Türkçe için özel bir koddur ve web tasarımı ile az çok uğraşan herkesin bildiği bir koddur. Ancak bu kodlamayı kullanmak için bazı ayarlamalar yapmak lazımdır..

   ISO kodlamasını kullanarak ASP.Net’te Türkçe karakter sorunu yaşamamak için web.config dosyasında ve sayfamızda ayarlar yapmamız lazım.

   Web.config dosyayı bildiğiniz gibi ASP.Net uygulamalarımız hakkında bazı ayarları yapmamızı sağlayan ve bu ayarları barındıran XML dosyasıdır. Aşağıda Türkçe karakter ayarı yapılmış bir web.config dosyasının kodları var. Ancak bu sadece bizi ilgilendiren kısmı, normalde bu sayfada daha çok şey var.






   Şimdi .aspx uzantılı sayfalarımızda yapacağımız ayara geçelim.ASP.Net sayfamızın “Page Directive”’inde yani ile başlayan satırında da Türkçe karakter kullanacağımızı belirtmemiz lazım. Bu satır aşağıdaki gibi olmalıdır.



   Ama bir dakika, bu da ne? 25899, hani biz ISO kullanıyorduk? Bu sayı ASP.Net’te bizim iso-8859-9 ‘a denk düşen bir kodlama.

   Eğer yukarıdaki 2 ayarı yaptıysanız sayfalarınızda Türkçe karakter sorunu olmaması lazım. Ancak dikkat etmeniz gereken bir nokta web.config te böyle bir kodlamadan bahsederken, sayfamızda kod olarak başka bir dile işaret edecek bir kodlama kullanırsanız sayfalarınızın kafası karışır..

   Sanıyorum artık Türkçe probleminiz kalmamıştır…



http://www.altinsoft.com/destek/haber/370-programlama-dilleri-aspnet-ile-turkce-karakter.html

linq to sql - başka tablolardaki ilişkili kayıtları silmek

bir tablodan bir kayıt silinecekken bu kayıtla ilişkili diğer tablolardaki tüm kayıtlar da otomatik olarak silinmek isteniyorsa...

örnek:
prod tablosundan bir kayıt silinecek ve bunla ilgili olarak prod_lang ve prod_usagaearea tablolarındaki ilişkili kayıtlar da silinecek ise;

prod & prod_lang ve prod & prod_usagearea tabloları arasındaki ilişkiler (associations) 'de delete rule özelliği cascade olarak ayarlanmalı.

linq to sql - left outer join with

            var prod_Langs = from p_l in db.Prod_Langs
                             join p in db.Prods on p_l.ProdID equals p.ProdID
                             join p_ua in db.Prod_UsageAreas on p_l.ProdID equals p_ua.ProdID
                             where (catId == null || catId < 1 || p.CatID == catId)
                                   && (brandId == null || brandId < 1 || p.BrandID == brandId)
                                   && (usageAreaId == null || usageAreaId < 1 || p_ua.UsageAreaID == usageAreaId)
                                   && p_l.LangID == langId
                             select p_l;

yerine


            var prod_Langs = from p_l in db.Prod_Langs
                             join p in db.Prods on p_l.ProdID equals p.ProdID
                             join p_ua in db.Prod_UsageAreas on p.ProdID equals p_ua.ProdID
                                into data from x in data.DefaultIfEmpty()
                             where (catId == null || catId < 1 || p.CatID == catId)
                                   && (brandId == null || brandId < 1 || p.BrandID == brandId)
                                   && (usageAreaId == null || usageAreaId < 1 || x.UsageAreaID == usageAreaId)
                                   && p_l.LangID == langId
                             select p_l;

linq join'i inner join olarak sql'e çeviriyor. left outer join için

into data from x in data.DefaultIfEmpty()

kısmını ekledik.

http://www.oguzyagmur.com/PermaLink,guid,b9fcc750-0e3b-43e4-a9e8-212ee94afa4e.aspx

linq to sql - [error] An attempt was made to remove a relationship between a [mastertable] and a [detailtable]. However, one of the relationship's foreign keys (detailtable.foreignkey1) cannot be set to null


System.InvalidOperationException: An attempt was made to remove a relationship between a Order and a OrderDetail. However, one of the relationship's foreign keys (OrderDetail.OrderID) cannot be set to null.
To fix this we need to indicate to the model that we want to delete the OrderDetail when it's OrderID is set to null. Unfortunately this cannot be done in the O/R designer so you have to open the model in an XML editor. Fortunately, once you change it the designer won't mess with it again unless you remove the class completely. Open the dbml file with the XML Editor (just right-click on it an select "Open with...") and locate the XML that describes the OrderDetail class. Notice the association under the OrderDetail table:
<Table Name="dbo.OrderDetail" Member="OrderDetails">
  <Type Name="OrderDetail">
    <Column Name="OrderDetailID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" 
            IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    <Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="Quantity" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
    <Column Name="Price" Type="System.Decimal" DbType="Money" CanBeNull="true" />
    <Column Name="Modified" Type="System.Data.Linq.Binary" DbType="rowversion NOT NULL" 
            CanBeNull="false" IsVersion="true" />
    <Association Name="Order_OrderDetail" Member="Order" ThisKey="OrderID" 
                 Type="Order" IsForeignKey="true"/>
     Name="Product_OrderDetail" Member="Product" ThisKey="ProductID" 
                 Type="Product" IsForeignKey="true" />
  Type>
We need to add an attribute here called DeleteOnNull and set it to true in order to be able to delete a child row independently in the database when calling SubmitChanges(). Once we make this change we can now delete just a single OrderDetail from the grid and save normally:
<Association Name="Order_OrderDetail" Member="Order" ThisKey="OrderID" Type="Order" 
             IsForeignKey="true" DeleteOnNull="true"/>
The other option to fix this issue is to modify the Delete Rule to "Cascade" on the relationship in the database. In that case the designer correctly infers this attribute on the association.

http://blogs.msdn.com/bethmassi/archive/2008/02/19/one-to-many-master-detail-forms-with-linq-to-sql.aspx

not: 1. yol sorunu çözdü.

not 2. eğer ilişki prod, usagearea, prod_usagearea biçimindeyse;

[Association(Name="Prod_Prod_UsageArea", Storage="_Prod", ThisKey="ProdID", OtherKey="ProdID", IsForeignKey=true, DeleteOnNull = true)]

[Association(Name = "UsageArea_Prod_UsageArea", Storage = "_UsageArea", ThisKey = "UsageAreaID", OtherKey = "UsageAreaID", IsForeignKey = true, DeleteOnNull = true)]

prod_usagearea tablosu:
prodid (primarykey, int, not null)
usageareaid (primarykey, int, not null)

c# 3.x - List.Insert

var countries = Application["CountryList"] as List;
countries.Insert(0, new Country {CountryID = 0, Title = "Ülke"});

Application["CountryList"]'e de bir Country ekliyor.

Bunun yerine;

var countries = new List();
countries.Add(new Country {CountryID = 0, Title = "Ülke"});
countries.AddRange(Application["CountryList"] as List);

search this blog (most likely not here)