Hello,
First of all that might be kind of a stupid question but I really need it:). Here it is-->I have tried to insert new record in gridview but when I click on the "NEW" - link button, I just do nothing. So i've looked all arround and didn't find something that can help me. All the help code is using Code Behind and bind() the gridView. Actually I would like to make it as least code behind as I can. Any advice? Here is the "source":
Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProdID"
DataMember="DefaultView" DataSourceID="AccessDataSource1" HorizontalAlign="Center" AllowPaging="True" AllowSorting="True" TabIndex="3" BackColor="Transparent" Caption="#1063;#1072;#1089;#1090;#1080; - #1055;#1088;#1086;#1076;#1091;#1082;#1090;#1080;" OnRowUpdated="GridView2_RowUpdated" OnRowDeleted="GridView2_RowDeleted">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowHeader="True"
ShowInsertButton="True" />
<asp:BoundField DataField="ImeProd" HeaderText="ImeProd" SortExpression="ImeProd" />
<asp:BoundField DataField="Cena" HeaderText="Cena" SortExpression="Cena" />
<asp:ImageField DataAlternateTextField="SnimkaProd" dataimageurlformatstring="/website3/images/Products/{0}.jpg" DataAlternateTextFormatString="snimka na: {0}"
DataImageUrlField="SnimkaProd" HeaderText="Image" NullDisplayText="Empty">
</asp:ImageField>
<asp:TemplateField HeaderText="Upload File" ShowHeader="False" Visible="False">
<EditItemTemplate>
<input id="MyFile" type="file" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and this is the AccessDAtaSource:
Code:
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Li4niDanni.mdb"
SelectCommand="SELECT SnimkaProd, ProdID, ImeProd, Cena, CategorID FROM Produkti WHERE ([CategorID] = @CatIDSelected)"
UpdateCommand="UPDATE [Produkti] SET [SnimkaProd] = @SnimkaProd, [ImeProd] = @ImeProd, [Cena] = @Cena WHERE ProdID=@ProdID"
InsertCommand="INSERT INTO [Produkti] (ProdID, ImeProd, Cena, SnimkaProd) VALUES (@ProdID, @ImeProd, @Cena, @SnimkaProd)"
DeleteCommand="DELETE FROM [Produkti] WHERE [ProdID] = @ProdID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView3" Name="CatIDSelected" PropertyName="SelectedValue"/>
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ProdID" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="SnimkaProd" Type="String" />
<asp:Parameter Name="Cena" Type="String" />
<asp:Parameter Name="ImeProd" Type="String" />
<asp:Parameter Name="ProdID" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="SnimkaProd" Type="String" />
<asp:Parameter Name="ImeProd" Type="String" />
<asp:Parameter Name="Cena" Type="String" />
<asp:Parameter Name="ProdID" Type="String" />
</UpdateParameters>
</asp:AccessDataSource>
Thanks You,
G. Kalchev