|
Hi,
I need to implement a functionalty in vb.net 1.1 web apllication for a datagrid in which i am having a text box, a grid having 1000 rows records and a button,
when i give a value in the text box and press the button it should find the same value in the specific column of the grid and will move the scroll bar to that particular row. so that user can view the same row and it should be selected.
Need ur help on the same..........
Thanks
|
|
|
|
|
fill a DataView as dataset to the gridview.
DataView has Sort and FILTER options.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
but this will remove all the other rows and i want all the rows to be displayed and the selected row in the current view.
|
|
|
|
|
Hi, do you have source code? pls post it.
you can try
sqldataadapter da = new sqldataadapter();
datatable dt = new datatable();
da.fill(dt);
grid1.datasource = dt;
grid1.databind()
|
|
|
|
|
Dear all,
I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview?
In my case,the grid view will show name and description then the last field will be the image.
Any opinion or suggestion are welcom.
regards
cocoonwls
|
|
|
|
|
Hi, you can Add in your grid a image field.
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:ImageField>
</asp:ImageField>
</Columns>
</asp:GridView>
then this imagefield have properties to call the image from your database.
like: DataImageUrlField = dr("image").tostring();
Hope this one Can Help
Thanks
|
|
|
|
|
Hi sayrecollado,
thanks for your quick reply. But may i know where to add the DataImageUrlFiled?
regards
cocoonwls
|
|
|
|
|
Add the tag in the Gridview like this.
<asp:GridView>
<Columns>
<asp:imagefield dataimageurlfield='<%# DataBinder.Eval(Container.DataItem, "imagepath") %>'/>
</columns>
</asp:GridView>
Where imagepath is the Column of the Dataset having image path.
This will automatically display the image when you will bind the dataset to gridview.
Regards,
Kaushal Arora
|
|
|
|
|
Hi, thanks
I will try it and come back to you
regards
cocoonwls
|
|
|
|
|
Hi,
DataImageUrlField from your Grid properties
Like this:
<asp:GridView>
<Columns>
<asp:imagefield dataimageurlfield="ImgURL"/>
</columns>
</asp:GridView>
ImgURL field from your database tablename.columnfield
|
|
|
|
|
cocoonwls wrote: I am using VS2005, asp.net with c# and sql server2005. I am storing my picture path in database. Can anyone suggest me how can i display the picture according to the picture path in database into a gridview?
Yes!
Displaying Image in Gridview from Database
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi Abhijit,
That is a great article for a newbie in asp.net like me. But my image are located in C:\myFolder, so how can i display it from there? the path which i store in database is "C:\myFolder\img.gif". I saw in your article you always have the symbol "~", could you tell me why is like that?
thanks in advance,
and thanks for those reply me question~
regards
cocoonwls
|
|
|
|
|
Hi All,
Another problem i've is how do i handle events in dynamic usercontrol.
Actually i've a User Review Form in which i'm saving data on submit click event but as soon i click on submit the page goes off... as the page is also a dynamic page so what do i do. Moreover the submit even doesn't work as no data is being saved. I tried with
Response.write but nothing comes on page.
So please help me with this.
Regards
Paritosh Tripathi
B.Tech. (C.S.)
BrainTechnosys Ltd.
|
|
|
|
|
Hi, please post your code.
Thanks
|
|
|
|
|
I am facing a very critical issue associated with AJAX asynchronous postback. I am really running short of time for releasing the product.
Let me explain the scenario here.
We are supposed to create a web application to export data fetched from database to an excel file and download at client machine. And as we have specific request from client to use ajax popup for implementing this, we have used Ajax Modal Popup and a progress bar to show the status of the process and a download link button to invoke download, both contained in Update Panel.
.Net Framework : 3.5
Ajax Version : 3.0.20229.0
We have implemented this as folows:
<contenttemplate>
<cc1:modalpopupextender id="PopUpModalPopupExtender" targetcontrolid="PopUpDiv" runat="server" xmlns:cc1="#unknown">
PopupControlID="pnlPopup" DropShadow="False">
<asp anel="" id="pnlPopup" runat="server">
<asp:image id="imgGlobalProcessing" runat="server" imageurl="~/App_Themes/MyApp/images/progress.gif" xmlns:asp="#unknown">
Progressing ...
|
br mode="hold" />
<asp:linkbutton id="hlnkExcel" runat="server" text="Excel" onclick="hlnkExcel_Click" xmlns:asp="#unknown">
<triggers> <asp:asyncpostbacktrigger controlid="hlnkExcel" xmlns:asp="#unknown">
--Code Behind--
private void ExportToExcel(DataSet dsExport, string[] sHeaders, string[] sFileds, ExportFormat FormatType, string FileName)
{
MemoryStream stream = new MemoryStream();
try
{
response.Clear();
if (FormatType == ExportFormat.CSV)
{
response.ContentType = "text/csv";
response.AppendHeader("content-disposition", "attachment; filename=" + FileName);
}
else
{
response.ContentType = "application/vnd.ms-excel";
response.AppendHeader("content-disposition", "attachment; filename=" + FileName);
}
XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8);
System.IO.StringWriter sw = new System.IO.StringWriter();
CreateStylesheet(writer, sHeaders, sFileds, FormatType);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
XmlDataDocument xmlDoc = new XmlDataDocument(dsExport);
XslTransform xslTran = new XslTransform();
xslTran.Load(new XmlTextReader(stream), null, null);
xslTran.Transform(xmlDoc, null, sw, null);
//reads to a stream
byte[] byteArray = Encoding.ASCII.GetBytes(sw.ToString());
stream = new MemoryStream(byteArray);
// Buffer to read 10K bytes in chunk:
byte[] buffer = new Byte[10000];
// Length of the file:
int length = 0;
// Total bytes to read:
long dataToRead = 0;
dataToRead = stream.Length;
response.Cache.SetCacheability(HttpCacheability.Private);
response.Expires = -1;
response.Buffer = false;
length = stream.Read(buffer, 0, Convert.ToInt32(stream.Length));
response.OutputStream.Write(buffer, 0, length);
response.Flush();
stream.Close();
response.Close();
}
catch (ThreadAbortException Ex)
{
string ErrMsg = Ex.Message;
}
catch (Exception Ex)
{
throw Ex;
}
finally
{
if (stream != null)
{
//Close the file.
stream.Close();
}
response.Close();
}
}
But while running the application we are getting the following error:
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
As a solution for this I tried different techniques which i have listed below.
1. Set EnableEventValidation=false for the Page.
2. In the Application error event i put the Context.ClearErrors()
3. Disabled the cacheRolesInCookie in roleManager in Web.config
4. Used the Response.outputstream.write() instead of Response.Write() method
5. Cretae an iframe in the ascx control
I am really finding myself in a helpless situation. I would really appreciate any help on this.
Thanks in advance
Regards
Lini
|
|
|
|
|
hi
plz anyone in this fourm able tohelp me
My problem
i m constucting multilevel marketing project(mlm).So need to construct binary tree.i hav a database in sql server.in database i hav parent id and child id of all member.i want to display this tree so that every member an able to show there all child member.plz give me code or logic to diplay this tree.
thanks in advance
|
|
|
|
|
Any_India wrote: multilevel marketing project(mlm).
Oohh! A pyramid scheme.
If you are using SQL Server 2008 use the HierarchyID type - that is designed exactly for what you want.
If this doesn't help then I suggest you ask in the correct forum. You asked a database question, not an ASP.NET question.
|
|
|
|
|
actualy i need to display tree in asp.net page where i will provide parent and child name or id.i need the logic to traverse and disply tree with member name...tree like bellow
|
|
|
|
|
Hi Friends,
I'm using ASP.net 2.0 with VB. I want to create Horizontal menu with submenu that open verticully.
Problem :
1.But problem in frame.. if i'm taking frame then the length of frame became same length of vertical menu ....
2.Also I want call one page of that include menu code & I called the page at all pages so my time & code reduce
Please reply me as soon as possible...
On my mail address : pranav.kalyani@gmail.com
PK
|
|
|
|
|
Pranav Kalyani wrote: 1.But problem in frame.. if i'm taking frame then the length of frame became same length of vertical menu ....
are putting menu control inside IFrame ? Why ?
Pranav Kalyani wrote: Also I want call one page of that include menu code & I called the page at all pages so my time & code reduce
Pranav Kalyani wrote: Please reply me as soon as possible...
On my mail address : pranav.kalyani@gmail.com
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi, you can use Menu or Sitemappath under navigation tool.
why you want to input your menu in a frame?
|
|
|
|
|
just check the properties and don't put in frame. and don't think so. think little it so simple.
with best
j somasekhar
|
|
|
|
|
Dear friends
i have gridview with (one textbox ,dropdownlist,checkbox) , one add button and save btn in aspx form
initially gridview will not show any values , when user clicks Add button , gridview will show textbox ,dropdownlist and checkbox with blanks .
after user will fill up these fields , next when user wants one more row again he will click add button , then it will create new row in gridview with blank fields. finally he will click save button then grid values will be stored in database. for example
Empname(txt) Dept(ddl) Active(checkbox)
-- --- --
xyz Purchase Yes
Add btn Save btn
any body help me regarding this issue?
|
|
|
|
|
when u add each row, add it to a datatbale and finally on the click of the save button, take each row from the datatable and insert it into db.
add the below code in add button click,
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Number", typeof(string)));
dt.Columns.Add(new DataColumn("Name", typeof(string)));
if (ViewState["data"] != null)
dt = (DataTable)ViewState["data"];
DataRow dr = dt.NewRow();
dr["Number"] = this.TextBox1.Text;
dr["Name"] = this.TextBox2.Text;
dt.Rows.Add(dr);
GridView1.DataSource = dt;
GridView1.DataBind();
ViewState["data"] = dt;
and in save button
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Number", typeof(string)));
dt.Columns.Add(new DataColumn("Name", typeof(string)));
if (ViewState["data"] != null)
dt = (DataTable)ViewState["data"];
foreach (DataRow dr in dt.Rows)
{
code to insert in db
}
hope it helps u
|
|
|
|
|
1. Create a DataTable with the following columns Id, Ename, DeptNo, Status(Active/Inactive) with empty rows. Store this DataTable in Session.
2. Bind this DataTable to the GridView. As initially no rows in the DataTable , The GridViewwill be empty.
3. In the GridView RowBound event, Bind DeptNo Dropdown and Status checkbox controls with your data for each row of the DataTable.
4. On clicking add button, Update the changes done in the Gridview to the DataTable and then add an empty row to that DataTable. Again bind this DataTableto GridView. So whenever you click add button, the GridView will have a new row.
Hope this will address your requirement.
|
|
|
|