|
Abhijit Jana wrote: Yes I am on Code Project . UP and Running Laugh
swtlibra found you.lol
|
|
|
|
|
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
swtlibra wrote: Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Error is self describing.look at that.
I think you defined DataSourceID in the html.Check your html for GridView and remove that.
|
|
|
|
|
when i remove the datasource ID from gridview
it dosen't display the whole grid view 
|
|
|
|
|
swtlibra wrote: it dosen't display the whole grid view
Show us the code of GriView from aspxpage. And DataBind code from Codebehind page.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" <br />
DataKeyNames="Image_ID" <br />
AllowPaging="True" onrowdatabound="GridView1_RowDataBound" <br />
onselectedindexchanged="GridView1_SelectedIndexChanged"><br />
<Columns><br />
<asp:BoundField DataField="Image_ID" HeaderText="Image_ID" <br />
InsertVisible="False" ReadOnly="True" SortExpression="Image_ID" /><br />
<br />
<asp:TemplateField><br />
<ItemTemplate><br />
<asp:Image ID="img_1" ImageUrl='<%# Bind("Image_1") %>' runat="server" /><br />
</ItemTemplate><br />
</asp:TemplateField><br />
<br />
<asp:ImageField DataImageUrlField="Image_1"><br />
</asp:ImageField><br />
<asp:ImageField DataImageUrlField="Image_2"><br />
</asp:ImageField><br />
<asp:ImageField DataImageUrlField="Image_3"><br />
</asp:ImageField><br />
</Columns><br />
</asp:GridView><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
using System;<br />
using System.Collections;<br />
using System.Configuration;<br />
using System.Data;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.HtmlControls;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Xml.Linq;<br />
using System.Data.OleDb;<br />
using System.IO;<br />
<br />
public partial class samplepage : System.Web.UI.Page<br />
{<br />
OleDbConnection con;<br />
OleDbCommand cmd;<br />
OleDbDataReader rd;<br />
OleDbDataAdapter da;<br />
DataSet ds;<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("App_Data/testdb.mdb"));<br />
Load_GridData();<br />
}<br />
<br />
void Load_GridData()<br />
{<br />
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select Image_ID, Image_1, Image_2, Image_3 from Images", con);<br />
DataSet ds=new DataSet();<br />
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();<br />
con.Close();<br />
}<br />
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
((Image)e.Row.FindControl("img_1")).ImageUrl = "'@~/Upload/'" ;<br />
<br />
}<br />
}<br />
<br />
<br />
|
|
|
|
|
put a breakpoint at
GridView1.DataSource = ds;
and check if ds is filling correctly with data.
|
|
|
|
|
ok if we use a simple code then how the image will be displayed using code
through code simple data is displaying in the grid
|
|
|
|
|
swtlibra wrote: if we use a simple code then how the image will be displayed using code
Give the path of the image as relative url and check if that images existing in the solution.
|
|
|
|
|
where to give the path
plz tell about the code
|
|
|
|
|
Instead of
((Image)e.Row.FindControl("img_1")).ImageUrl = "'@~/Upload/'" ;
give something like,
((Image)e.Row.FindControl("img_1")).ImageUrl = @"~/Upload/imagename.jpg" ;
where imagename is the path from object source.
|
|
|
|
|
swtlibra wrote: where to give the path
Image path should be the database column . And physically your image storage location would be hard drive.
When you will retrieve the path from database, image will be load from drive.
The Article, which you have mention above, clearly explained each and every steps.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
want to create a Panel in ASP.NET ) with a check box as a header that disables all contained controls when unchecked. How do i so???
|
|
|
|
|
You can do it either by server side code or client side code.If you want to do it in server side use OnCheckedChanged event of checkbox.
|
|
|
|
|
I want to work on client side.
|
|
|
|
|
Add onclick attribute to checkbox and disable controls in the onclick event.
something like,
chkName.Attributes.Add("onclick", "return DisableControls();");
|
|
|
|
|
i can't find click event for a check box plz send me the code for onchange event
|
|
|
|
|
In the page load event do like this,
if (!IsPostBack)
{
chkSelect.Attributes.Add("onclick", "Check();");
}
and in html do like this,
<script type="text/javascript">
function Check()
{
}
</script>
haleemasher wrote: plz send me the code
Another thing is if somebody is giving you an idea then plz just try it out first by using online resources or MSDN help and if you feel any difficulties then we'll help if we know that.
Anyway happy to help you.
|
|
|
|
|
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Helo All,
I have defined one usercontrol UserDropdownlist and that UserDropdownlist i have bind in render method as per my requirement (Control render method) and on page when i hit submit one control load event i get item.count = 0 i don't why this happpen event data display on viewstate?
If that issue resolved if i am binding UserDropdownlist list in onload method of control so can you please tell me what is reason for that?
Thanks in Advance,
Anish Patel
|
|
|
|
|
anish27patel wrote: i have bind in render method
Its better to know the event cycle to solve this problem.
Your problem is because you are binding in Render.So it won't be there in ViewState.As u told use load for binding drop down.
Search MSDN for Event life cycle in ASP.NET.
|
|
|
|
|
Hi Experts,
I am using a simple text box and a hidden checklist control to get a multiselect text when i click on text box i just display the checklist by javascript methods and now i want to hide th checklist when i lose focus to the text box.
i have implemented onblur event for text box but when i try to click on checklist item the onblur event is fired and the checklist control is getting hidden.
Please help me to resolve this(may be in javascript only)
thanks
Sathish
modified on Friday, September 4, 2009 12:22 AM
|
|
|
|
|
I think better to make it as a usercontrol and try to add focus out attribute for the usercontrol.
|
|
|
|
|
I'm working on a project with basically two sections per page - the header and the content. I'd like stretch the content section (in a DIV) from normal to full-screen and back when another control (i.e. checkbox) is clicked. Any good examples of how to do this? Caveat: my header div has floating menus - I need to keep these on top of the content DIV.
Thanks!
Rob
http://tagyurit.com
|
|
|
|
|
Hi,
I have 2 Gridviews on an aspx page. When I select a record in the first GridView, the second Gridview should display details of the record selected.
How would I go about doing this?
Illegal Operation
|
|
|
|