Below is my requirement. I will have two browse buttons on the page , and two upload buttons on the page.
My requirement is to have both the attachments uploaded by the user to be displayed in a gridview in one row.
Upload1 and Upload2 are the two attachments uploaded by the user and i need to get them as below in the gridview.
Attachment 1 Attachment 2 Delete
Upload1 Upload2 Delete
Can you please help me with an easy way to achieve this?
If I understand you correctly you should be able to do this by using a TemplateField when you define your columns:
<Columns>
<asp:TemplateField HeaderText="FirstColumn">
<ItemTemplate>
<asp:FileUpload ID="fu_FirstFile" runat="server" /><br/>
<asp:Button ID="btn_UPloadFirst" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SecondCOlumn">
<ItemTemplate>
<asp:FileUpload ID="fu_SecondFile" runat="server" /><br/>
<asp:Button ID="btn_UPloadSecond" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
Related
I have a grid view in which in one column I want to display images. I have image URL stored in the database.I want the the gridview to dynamically bind the ImageField with the url from the database.
Try this.
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="ProductImage" runat="server" ImageUrl='<%# Eval("ProductImagePath") %>'/>
</ItemTemplate>
</asp:TemplateField>
Or this
<asp:ImageField HeaderText="Image" DataImageUrlField="ProductImagePath"/>
I have asp.net, and a webpage here:
<asp:GridView ID="BalanceCheckDataGridView" runat="server" AutoGenerateColumns="false" OnRowDataBound = "DataGridViewTotalSum" >
<Columns>
<asp:TemplateField HeaderText="Company" ItemStyle-Width="20%" >
<ItemTemplate>
<asp:HyperLink Text='<%# (Eval("Company"))%>' ID="HyperLink1" Target="_blank" runat="server"
NavigateUrl=WHAT SHOULD I PUT HERE IF I WANT TO NAVIGATE TO ANOTHER WEBPAGE IN THE SAME SOLUTION
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width="30%" DataField="Balance" HeaderText="Balance" />
</Columns>
</asp:GridView>
So column“Company” is a hyperlink. when people click on it, i want to show in another webpage or add a gridview of the details information about that company. So, I need to pass the company name to it too.
How should I set the link in the hyperlink field? so that it can navigates to a webpage inside the solution?
Thanks.
i have this imagefield in a gridview
<asp:ImageField HeaderText="Image" DataImageUrlField="Image_Path" ControlStyle-Width="50" ControlStyle-Height="50"/>
the image_path is a column name from the database that retuns the image link
i need to make this field clickable so once i click on it i need to popup a form just like this field:
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<asp:LinkButton ID="LinkButton3" CommandName="Select" onClick="popup_click" class="table-actions-button ic-table-edit" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
i tried to put an image button instead of an image field but i'm always getting submit query instead of the image...
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" DataImageUrlFormatString="Image_Path" ControlStyle-Width="50" ControlStyle-Height="50"/>
</ItemTemplate>
does anyone know how can i fix this?
I have the following button on GridView and I want to display a message box to the user for confirming whether he is sure or not for buying the item.(I'm familiar with OnClientClick= return confirm('xxxxx'); ) but on Grid View it is different I can't use this method though.
<asp:ButtonField CommandName="buynow" ImageUrl="~/images/buy.png" HeaderText="BUY" ButtonType="Image"/>
Use itemtemplate field in column node in gridview markup
eg.
<asp:TemplateField HeaderText="Save">
<ItemTemplate>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="return confirm('Do you want to save?')" />
</ItemTemplate>
</asp:TemplateField>
Apologies for the newbie question. My client wishes me to make a small change to the gridview on his http://www.flogitdonegal.com/SearchPage.aspx page.
Note the way the Title column is a hyperlink to view more information. This comes from a 'BriefDescription' field in the database.
How can I add 250 chars from the 'FullDescription' underneath the Title in the same cell, but I dont want it be a hyperlink.
Essentially it will be 2 fields coming into the same column.
Thanks in advance for all help.
John
If this is using a GridView you are most likely using a TemplateField as it is to display the HyperLink.
Within the ItemTemplate of the TemplateField you can specify an additional Label underneath using something as follows:
<asp:Label runat="server" id="FullDescLabel" Text='<%# DataBinder.Eval(Container.DataItem, "FullDescription") %>' />
You need to use the TemplateField and here is a tutorial that explains some of the other fields that GridView offers as well.
<asp:GridView ID="gvwCompounds" runat="server" DataSourceID="objItemsFromYourDB">
<Columns>
....
<asp:TemplateField>
<ItemTemplate HeaderText="Title">
<asp:HyperLink runat="server" ID="Hperlink1" NavigateUrl='<%# Eval("BriefDescriptionUrl") %>' Text='<%# Eval("BriefDescription") %>' />
<br />
<asp:Label runat="server" ID="Label1" Text='<%# Eval("FullDescription") %>' />
</ItemTemplate>
</asp:TemplateField>
....
</Columns>
</asp:GridView>